Ignore:
Timestamp:
Sep 5, 2007, 11:01:56 PM (13 years ago)
Author:
charles
Message:

(trunk) fix some of the crash-on-shutdown issues.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/platform.c

    r2865 r2975  
    6767#elif defined(WIN32)
    6868    HANDLE           thread;
     69    unsigned int     thread_id;
    6970#else
    7071    pthread_t        thread;
     
    117118    resume_thread( t->thread );
    118119#elif defined(WIN32)
    119     t->thread = (HANDLE) _beginthreadex( NULL, 0, &ThreadFunc, t, 0, NULL );
     120    t->thread = (HANDLE) _beginthreadex( NULL, 0, &ThreadFunc, t, 0, &t->thread_id );
    120121#else
    121122    pthread_create( &t->thread, NULL, (void * (*) (void *)) ThreadFunc, t );
     
    125126}
    126127
     128int
     129tr_amInThread ( const tr_thread_t * t )
     130{
     131    int ret;
     132#ifdef __BEOS__
     133    ret = find_thread(NULL) == t->thread;
     134#elif defined(WIN32)
     135    ret = GetCurrentThreadId() == t->thread_id;
     136#else
     137    ret = pthread_equal( t->thread, pthread_self( ) );
     138#endif
     139    return ret;
     140}
     141   
    127142void
    128143tr_threadJoin( tr_thread_t * t )
     
    349364    int start, end;
    350365#elif defined(WIN32)
    351     tr_list_t * events;
     366    tr_list * events;
    352367    tr_lock_t * lock;
    353368#else
     
    492507#elif defined(WIN32)
    493508
    494     tr_list_t * l;
     509    tr_list * l;
    495510    tr_lockLock( c->lock );
    496511    for( l=c->events; l!=NULL; l=l->next )
Note: See TracChangeset for help on using the changeset viewer.