Changeset 1401 for trunk/libtransmission/platform.c
- Timestamp:
- Jan 19, 2007, 1:39:33 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/platform.c
r1356 r1401 195 195 } 196 196 197 void tr_threadCreate( tr_thread_t * t, void (*func)(void *), void * arg ) 198 { 199 #ifdef SYS_BEOS 200 *t = spawn_thread( (void *) func, "torrent-tx", B_NORMAL_PRIORITY, arg ); 201 resume_thread( *t ); 202 #else 203 pthread_create( t, NULL, (void *) func, arg ); 197 static void ThreadFunc( void * _t ) 198 { 199 tr_thread_t * t = _t; 200 201 #ifdef SYS_BEOS 202 /* This is required because on BeOS, SIGINT is sent to each thread, 203 which kills them not nicely */ 204 signal( SIGINT, SIG_IGN ); 205 #endif 206 207 tr_dbg( "Thread '%s' started", t->name ); 208 t->func( t->arg ); 209 tr_dbg( "Thread '%s' exited", t->name ); 210 } 211 212 void tr_threadCreate( tr_thread_t * t, void (*func)(void *), void * arg, 213 char * name ) 214 { 215 t->func = func; 216 t->arg = arg; 217 t->name = strdup( name ); 218 #ifdef SYS_BEOS 219 t->thread = spawn_thread( (void *) ThreadFunc, name, 220 B_NORMAL_PRIORITY, t ); 221 resume_thread( t->thread ); 222 #else 223 pthread_create( &t->thread, NULL, (void *) ThreadFunc, t ); 204 224 #endif 205 225 } … … 209 229 #ifdef SYS_BEOS 210 230 long exit; 211 wait_for_thread( *t, &exit ); 212 #else 213 pthread_join( *t, NULL ); 214 #endif 231 wait_for_thread( t->thread, &exit ); 232 #else 233 pthread_join( t->thread, NULL ); 234 #endif 235 tr_dbg( "Thread '%s' joined", t->name ); 236 free( t->name ); 215 237 } 216 238
Note: See TracChangeset
for help on using the changeset viewer.