int main( int argc, char **argv ) { char buff[256]; TID tid; APIRET rc; MemInit(); getcmd( buff ); CmdData = buff; DebugMain(); _SwitchOff( SW_ERROR_STARTUP ); DoInput(); VarInitInfo( &Locals ); DosCreateEventSem( NULL, &Requestsem, 0, false ); DosCreateEventSem( NULL, &Requestdonesem, 0, false ); DosPostEventSem( Requestdonesem ); // signal req done rc = DosCreateThread( &tid, ControlFunc, 0, 0, 32768 ); if( rc != 0 ) { printf( "Stubugger: Error creating thread!\n" ); } while( !Done ) { DlgCmd(); } DosCloseEventSem( Requestsem ); DosCloseEventSem( Requestdonesem ); DebugFini(); RunRequest( REQ_BYE ); MemFini(); return( 0 ); }
int main( int argc, char **argv ) { char buff[256]; DWORD tid; HANDLE hThread; MemInit(); SetErrorMode( SEM_FAILCRITICALERRORS ); getcmd( buff ); CmdData = buff; DebugMain(); _SwitchOff( SW_ERROR_STARTUP ); DoInput(); VarInitInfo( &Locals ); Requestsem = CreateSemaphore( NULL, 0, 1, NULL ); Requestdonesem = CreateSemaphore( NULL, 0, 1, NULL ); ReleaseSemaphore( Requestdonesem, 1, NULL ); // signal req done hThread = CreateThread( NULL, 0, ControlFunc, NULL, 0, &tid ); if (hThread == NULL) { MessageBox( NULL, "Error creating thread!", "Stubugger", MB_APPLMODAL+MB_OK ); } while( !Done ) { DlgCmd(); } CloseHandle( Requestsem ); CloseHandle( Requestdonesem ); DebugFini(); RunRequest( REQ_BYE ); MemFini(); return( 0 ); }