void InitDebug( struct TDebug *obj, const char *Program, const char *Param, const char *StartDir ) { obj->FProgram = malloc( strlen( Program ) + 1 ); strcpy( obj->FProgram, Program ); obj->FParam = malloc( strlen( Param ) + 1 ); strcpy( obj->FParam, Param ); obj->FStartDir = malloc( strlen( StartDir ) + 1 ); strcpy( obj->FStartDir, StartDir ); obj->UserWait = RdosCreateWait(); obj->UserSignal = RdosCreateSignal(); RdosAddWaitForSignal( obj->UserWait, obj->UserSignal, obj ); obj->FSection = RdosCreateSection(); obj->ThreadList = 0; obj->ModuleList = 0; obj->CurrentThread = 0; obj->BreakList = 0; obj->FThreadChanged = FALSE; obj->FModuleChanged = FALSE; RdosCreateThread(DebugThread, "Debug device", obj, 0x4000); }
int __CBeginThread( thread_fn *start_addr, int prio, const char *thread_name, unsigned stack_size, void *arglist ) /************************************************************/ { thread_args *td; int th; int wait_handle; if( __TlsIndex == NO_INDEX ) { if( !__RdosThreadInit() ) return( -1L ); __InitMultipleThread(); } td = malloc( sizeof( *td ) ); if( td == NULL ) { _RWD_errno = ENOMEM; return( -1L ); } stack_size = __ROUND_UP_SIZE_4K( stack_size ); wait_handle = RdosCreateWait(); td->rtn = start_addr; td->argument = arglist; td->signal = RdosCreateSignal(); RdosResetSignal( td->signal ); RdosAddWaitForSignal( wait_handle, td->signal, 0 ); __create_thread(begin_thread_helper, prio, thread_name, td, stack_size); RdosWaitForever( wait_handle ); RdosFreeSignal( td->signal ); RdosCloseWait( wait_handle ); th = td->tid; free( td ); return( th ); }
void InitDebug( struct TDebug *obj, const char *Program, const char *Param, const char *StartDir ) { obj->FProgram = malloc( strlen( Program ) + 1 ); strcpy( obj->FProgram, Program ); obj->FParam = malloc( strlen( Param ) + 1 ); strcpy( obj->FParam, Param ); obj->FStartDir = malloc( strlen( StartDir ) + 1 ); strcpy( obj->FStartDir, StartDir ); obj->UserWait = RdosCreateWait(); obj->UserSignal = RdosCreateSignal(); RdosAddWaitForSignal( obj->UserWait, obj->UserSignal, obj ); obj->FSection = RdosCreateSection(); obj->ThreadList = 0; obj->ModuleList = 0; obj->CurrentThread = 0; obj->NewThread = 0; obj->BreakList = 0; obj->WatchList = 0; obj->FThreadChanged = FALSE; obj->FModuleChanged = FALSE; obj->FHandle = 0; obj->FMemoryModel = DEBUG_MEMORY_MODEL_FLAT; obj->FConfigChange = FALSE; obj->FAsyncBreak = FALSE; obj->FAsyncSel = 0; obj->FAsyncOffset = 0; obj->FWaitLoad = TRUE; RdosCreateThread( DebugThread, "Debug device", obj, 0x4000 ); }