From f1ce4ea4994aa1488b51b6004546aafede72ed74 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Tue, 10 Feb 2009 14:49:11 +0000 Subject: unify lock and unlock code style --- ot_mutex.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'ot_mutex.c') diff --git a/ot_mutex.c b/ot_mutex.c index 0127721..925eb27 100644 --- a/ot_mutex.c +++ b/ot_mutex.c @@ -74,6 +74,7 @@ static void bucket_remove( int bucket ) { --bucket_locklist_count; } +/* Can block */ ot_vector *mutex_bucket_lock( int bucket ) { pthread_mutex_lock( &bucket_mutex ); 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 ) { - int bucket = uint32_read_big( (char*)hash ) >> OT_BUCKET_COUNT_SHIFT; - - /* Can block */ - mutex_bucket_lock( bucket ); - return all_torrents + bucket; + return mutex_bucket_lock( uint32_read_big( (char*)hash ) >> OT_BUCKET_COUNT_SHIFT ); } void mutex_bucket_unlock( int bucket, int delta_torrentcount ) { -- cgit v1.2.3