diff --git a/ot_mutex.c b/ot_mutex.c index 772d936..9d87d0f 100644 --- a/ot_mutex.c +++ b/ot_mutex.c @@ -25,65 +25,14 @@ /* Our global all torrents list */ static ot_vector all_torrents[OT_BUCKET_COUNT]; +static pthread_mutex_t bucket_mutex[OT_BUCKET_COUNT]; static size_t g_torrent_count; -/* Bucket Magic */ -static int bucket_locklist[ OT_MAX_THREADS ]; -static int bucket_locklist_count = 0; -static pthread_mutex_t bucket_mutex; -static pthread_cond_t bucket_being_unlocked; - /* Self pipe from opentracker.c */ extern int g_self_pipe[2]; -static int bucket_check( int bucket ) { - /* C should come with auto-i ;) */ - int i; - - /* No more space to acquire lock to bucket -- should not happen */ - if( bucket_locklist_count == OT_MAX_THREADS ) { - fprintf( stderr, "More lock requests than mutexes. Consult source code.\n" ); - return -1; - } - - /* See, if bucket is already locked */ - for( i=0; i