Ignore:
Timestamp:
Jan 14, 2007, 12:11:06 PM (15 years ago)
Author:
titer
Message:

Use tr_cond* a bit more

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/net.c

    r1356 r1357  
    4545static tr_thread_t  resolveThread;
    4646static tr_lock_t    resolveLock;
     47static tr_cond_t    resolveCond;
    4748static volatile int resolveDie;
    4849static tr_resolve_t * resolveQueue;
     
    7273    resolveQueue = NULL;
    7374    tr_lockInit( &resolveLock );
     75    tr_condInit( &resolveCond );
    7476    tr_threadCreate( &resolveThread, resolveFunc, NULL );
    7577}
     
    8789    resolveDie = 1;
    8890    tr_lockUnlock( &resolveLock );
     91    tr_condSignal( &resolveCond );
    8992    tr_wait( 200 );
    9093}
     
    117120    }
    118121    tr_lockUnlock( &resolveLock );
     122    tr_condSignal( &resolveCond );
    119123
    120124    return r;
     
    187191        if( !( r = resolveQueue ) )
    188192        {
    189             /* TODO: Use a condition wait */
    190             tr_lockUnlock( &resolveLock );
    191             tr_wait( 50 );
    192             tr_lockLock( &resolveLock );
     193            tr_condWait( &resolveCond, &resolveLock );
    193194            continue;
    194195        }
Note: See TracChangeset for help on using the changeset viewer.