Ignore:
Timestamp:
Dec 2, 2007, 6:20:37 PM (13 years ago)
Author:
charles
Message:

more mutex work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/platform.c

    r4041 r4042  
    242242tr_lockLock( tr_lock * l )
    243243{
    244     const tr_thread_id currentThread = tr_getCurrentThread( );
    245 
    246244#ifdef __BEOS__
    247245    acquire_sem( l->lock );
     
    251249    pthread_mutex_lock( &l->lock );
    252250#endif
    253     l->lockThread = currentThread;
     251    l->lockThread = tr_getCurrentThread( );
    254252    ++l->depth;
     253/* fprintf( stderr, "thread %lu acquired lock %p... depth is now %d\n", (unsigned long)l->lockThread, l, l->depth ); */
    255254    assert( l->depth >= 1 );
    256255}
     
    266265tr_lockUnlock( tr_lock * l )
    267266{
     267/* fprintf( stderr, "thread %lu releasing lock %p... depth before release is %d\n", (unsigned long)l->lockThread, l, l->depth ); */
     268
    268269    assert( l->depth > 0 );
    269270    assert( tr_areThreadsEqual( l->lockThread, tr_getCurrentThread() ));
    270271    assert( tr_lockHave( l ) );
    271272
    272 #ifdef __BEOS__
    273     release_sem( l->lock );
    274 #elif defined(WIN32)
    275     LeaveCriticalSection( &l->lock );
    276 #else
    277     pthread_mutex_unlock( &l->lock );
    278 #endif
    279273    --l->depth;
    280274    assert( l->depth >= 0 );
     275#ifdef __BEOS__
     276    release_sem( l->lock );
     277#elif defined(WIN32)
     278    LeaveCriticalSection( &l->lock );
     279#else
     280    pthread_mutex_unlock( &l->lock );
     281#endif
    281282}
    282283
Note: See TracChangeset for help on using the changeset viewer.