Changeset 5164
- Timestamp:
- Feb 28, 2008, 4:40:31 PM (13 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/platform.c
r5081 r5164 96 96 void * arg; 97 97 const char * name; 98 99 #ifdef __BEOS__ 100 thread_id thread; 101 #elif defined(WIN32) 102 HANDLE thread; 103 unsigned int thread_id; 104 #else 105 pthread_t thread; 106 #endif 107 98 tr_thread_id thread; 99 #ifdef WIN32 100 HANDLE thread_handle; 101 #endif 108 102 }; 109 103 … … 148 142 { 149 143 tr_thread * t = tr_new0( tr_thread, 1 ); 144 145 #ifdef __BEOS__ 146 t->thread = spawn_thread( (void*)ThreadFunc, name, B_NORMAL_PRIORITY, t ); 147 resume_thread( t->thread ); 148 #elif defined(WIN32) 149 unsigned id; 150 t->thread_handle = (HANDLE) _beginthreadex( NULL, 0, &ThreadFunc, t, 0, &id ); 151 t->thread = (DWORD) id; 152 #else 153 pthread_create( &t->thread, NULL, (void * (*) (void *)) ThreadFunc, t ); 154 #endif 150 155 t->func = func; 151 156 t->arg = arg; 152 157 t->name = name; 153 158 154 #ifdef __BEOS__155 t->thread = spawn_thread( (void*)ThreadFunc, name, B_NORMAL_PRIORITY, t );156 resume_thread( t->thread );157 #elif defined(WIN32)158 t->thread = (HANDLE) _beginthreadex( NULL, 0, &ThreadFunc, t, 0, &t->thread_id );159 #else160 pthread_create( &t->thread, NULL, (void * (*) (void *)) ThreadFunc, t );161 #endif162 163 159 return t; 164 160 } … … 173 169 wait_for_thread( t->thread, &exit ); 174 170 #elif defined(WIN32) 175 WaitForSingleObject( t->thread , INFINITE );176 CloseHandle( t->thread );171 WaitForSingleObject( t->thread_handle, INFINITE ); 172 CloseHandle( t->thread_handle ); 177 173 #else 178 174 pthread_join( t->thread, NULL ); -
trunk/libtransmission/transmission.c
r5081 r5164 213 213 tr_globalIsLocked( const struct tr_handle * handle ) 214 214 { 215 return tr_lockHave( handle->lock );215 return handle && tr_lockHave( handle->lock ); 216 216 } 217 217
Note: See TracChangeset
for help on using the changeset viewer.