BOOL fnTerminateThreadInfo(void) { int index = 0; if (g_tinfoSem) { #ifdef MPK_ON kSemaphoreWait(g_tinfoSem); #else WaitOnLocalSemaphore(g_tinfoSem); #endif //MPK_ON for (index = 0; index < NUM_ENTRIES; index++) { if (g_ThreadInfo[index] != NULL) { #ifdef MPK_ON kSemaphoreSignal(g_tinfoSem); #else SignalLocalSemaphore(g_tinfoSem); #endif //MPK_ON return FALSE; } } #ifdef MPK_ON kSemaphoreFree(g_tinfoSem); g_tinfoSem = NULL; #else CloseLocalSemaphore(g_tinfoSem); g_tinfoSem = 0; #endif //MPK_ON } return TRUE; }
void __FiniFThreadProcessing( void ) { //=============================================== #if defined( __OS2__ ) DosCloseMutexSem( __fio_sem ); #elif defined( __NETWARE__ ) CloseLocalSemaphore( __fio_sem ); #elif defined( __NT__ ) CloseHandle( __fio_sem ); #elif defined( __LINUX__ ) // TODO: semaphore support for Linux! #endif }
extern int __CBeginThread( thread_fn *start_addr, void *stack_bottom, unsigned stack_size, void *arglist ) { begin_thread_data data; data.start_addr = start_addr; data.stack_bottom = stack_bottom; data.arglist = arglist; data.semaphore = OpenLocalSemaphore( 0 ); if( BeginThread( &begin_thread_helper, stack_bottom, stack_size, &data ) != -1 ) { WaitOnLocalSemaphore( data.semaphore ); } else { data.tid = -1; } CloseLocalSemaphore( data.semaphore ); return( data.tid ); }
virtual ~TraceCriticalSection() { CloseLocalSemaphore( m_sem ); };