summaryrefslogtreecommitdiff
path: root/ot_mutex.c
diff options
context:
space:
mode:
authorerdgeist <>2009-02-10 14:49:11 +0000
committererdgeist <>2009-02-10 14:49:11 +0000
commitf1ce4ea4994aa1488b51b6004546aafede72ed74 (patch)
tree8dc8b5b34ef9c481d5ff1571f10e50a6724c9967 /ot_mutex.c
parent957981ac73929d5aa720ba9bb3363ce0da411f14 (diff)
unify lock and unlock code style
Diffstat (limited to 'ot_mutex.c')
-rw-r--r--ot_mutex.c7
1 files changed, 2 insertions, 5 deletions
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 ) {
74 --bucket_locklist_count; 74 --bucket_locklist_count;
75} 75}
76 76
77/* Can block */
77ot_vector *mutex_bucket_lock( int bucket ) { 78ot_vector *mutex_bucket_lock( int bucket ) {
78 pthread_mutex_lock( &bucket_mutex ); 79 pthread_mutex_lock( &bucket_mutex );
79 while( bucket_check( bucket ) ) 80 while( bucket_check( bucket ) )
@@ -84,11 +85,7 @@ ot_vector *mutex_bucket_lock( int bucket ) {
84} 85}
85 86
86ot_vector *mutex_bucket_lock_by_hash( ot_hash hash ) { 87ot_vector *mutex_bucket_lock_by_hash( ot_hash hash ) {
87 int bucket = uint32_read_big( (char*)hash ) >> OT_BUCKET_COUNT_SHIFT; 88 return mutex_bucket_lock( uint32_read_big( (char*)hash ) >> OT_BUCKET_COUNT_SHIFT );
88
89 /* Can block */
90 mutex_bucket_lock( bucket );
91 return all_torrents + bucket;
92} 89}
93 90
94void mutex_bucket_unlock( int bucket, int delta_torrentcount ) { 91void mutex_bucket_unlock( int bucket, int delta_torrentcount ) {