static void s_signalHandlersInit() { #if defined( HB_THREAD_SUPPORT ) && ( defined( HB_OS_UNIX ) || defined( HB_OS_UNIX ) ) pthread_t res; HB_STACK * pStack; s_serviceSetHBSig(); pStack = hb_threadCreateStack( 0 ); pthread_create( &res, NULL, s_signalListener, pStack ); #else s_serviceSetHBSig(); #endif sp_hooks = hb_itemNew( NULL ); hb_arrayNew( sp_hooks, 0 ); hb_vmAtQuit( hb_service_exit, NULL ); }
static void s_signalHandlersInit() { #if defined( HB_THREAD_SUPPORT ) && ( defined( HB_OS_UNIX ) || defined( HB_OS_UNIX_COMPATIBLE ) ) pthread_t res; HB_STACK *pStack; s_serviceSetHBSig(); pStack = hb_threadCreateStack( 0 ); pthread_create( &res, NULL, s_signalListener, pStack ); #else s_serviceSetHBSig(); #endif #if defined( HB_THREAD_SUPPORT ) HB_CRITICAL_INIT( s_ServiceMutex ); #endif sp_hooks = hb_itemNew( NULL ); hb_arrayNew( sp_hooks, 0 ); }
BOOL WINAPI s_ConsoleHandlerRoutine( DWORD dwCtrlType ) { #ifdef HB_THREAD_SUPPORT HB_STACK * pStack = NULL; /* we need a new stack: this is NOT an hb thread. */ if( TlsGetValue( hb_dwCurrentStack ) == 0 ) { pStack = hb_threadCreateStack( GetCurrentThreadId() ); pStack->th_h = GetCurrentThread(); TlsSetValue( hb_dwCurrentStack, ( void * ) pStack ); } #endif s_signalHandler( 2, dwCtrlType, NULL ); #ifdef HB_THREAD_SUPPORT if( pStack ) hb_threadDestroyStack( pStack ); #endif /* We have handled it */ return TRUE; }