mirror of
https://erdgeist.org/gitweb/opentracker
synced 2024-05-10 07:54:50 +00:00
unify lock and unlock code style
This commit is contained in:
@ -74,6 +74,7 @@ static void bucket_remove( int bucket ) {
|
|||||||
--bucket_locklist_count;
|
--bucket_locklist_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Can block */
|
||||||
ot_vector *mutex_bucket_lock( int bucket ) {
|
ot_vector *mutex_bucket_lock( int bucket ) {
|
||||||
pthread_mutex_lock( &bucket_mutex );
|
pthread_mutex_lock( &bucket_mutex );
|
||||||
while( bucket_check( bucket ) )
|
while( bucket_check( bucket ) )
|
||||||
@ -84,11 +85,7 @@ ot_vector *mutex_bucket_lock( int bucket ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ot_vector *mutex_bucket_lock_by_hash( ot_hash hash ) {
|
ot_vector *mutex_bucket_lock_by_hash( ot_hash hash ) {
|
||||||
int bucket = uint32_read_big( (char*)hash ) >> OT_BUCKET_COUNT_SHIFT;
|
return mutex_bucket_lock( uint32_read_big( (char*)hash ) >> OT_BUCKET_COUNT_SHIFT );
|
||||||
|
|
||||||
/* Can block */
|
|
||||||
mutex_bucket_lock( bucket );
|
|
||||||
return all_torrents + bucket;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mutex_bucket_unlock( int bucket, int delta_torrentcount ) {
|
void mutex_bucket_unlock( int bucket, int delta_torrentcount ) {
|
||||||
|
Reference in New Issue
Block a user