Ignore:
Timestamp:
Jan 14, 2007, 12:00:21 PM (14 years ago)
Author:
titer
Message:

Merge io branch into trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/platform.c

    r1000 r1356  
    233233}
    234234
     235
     236void tr_condInit( tr_cond_t * c )
     237{
     238#ifdef SYS_BEOS
     239    *c = -1;
     240#else
     241    pthread_cond_init( c, NULL );
     242#endif
     243}
     244
     245void tr_condWait( tr_cond_t * c, tr_lock_t * l )
     246{
     247#ifdef SYS_BEOS
     248    *c = find_thread( NULL );
     249    release_sem( *l );
     250    suspend_thread( *c );
     251    acquire_sem( *l );
     252    *c = -1;
     253#else
     254    pthread_cond_wait( c, l );
     255#endif
     256}
     257
     258void tr_condSignal( tr_cond_t * c )
     259{
     260#ifdef SYS_BEOS
     261    while( *c != -1 )
     262    {
     263        thread_info info;
     264        get_thread_info( *c, &info );
     265        if( info.state == B_THREAD_SUSPENDED )
     266        {
     267            resume_thread( *c );
     268            break;
     269        }
     270        snooze( 5000 );
     271    }
     272#else
     273    pthread_cond_signal( c );
     274#endif
     275}
     276
     277void tr_condClose( tr_cond_t * c )
     278{
     279#ifndef SYS_BEOS
     280    pthread_cond_destroy( c );
     281#endif
     282}
     283
     284
    235285#if defined( BSD )
    236286
Note: See TracChangeset for help on using the changeset viewer.