//----------------------------------------------------------------------------- // XBX_InitConsoleMonitor // //----------------------------------------------------------------------------- void CXboxConsole::InitConsoleMonitor( bool bWaitForConnect ) { if ( XBX_NoXBDM() ) return; // create our events g_xbx_dbgValidEvent = CreateEvent( XBOX_DONTCARE, TRUE, FALSE, NULL ); g_xbx_dbgCmdCompleteEvent = CreateEvent( XBOX_DONTCARE, FALSE, FALSE, NULL ); // register our command handler with the debug monitor HRESULT hr = DmRegisterCommandProcessor( XBX_DBGCOMMANDPREFIX, _DebugCommandHandler ); if ( FAILED( hr ) ) { XBX_Error( "XBX_InitConsoleMonitor: failed to register command processor" ); } // user can have output bypass slave thread g_xbx_bDoSyncOutput = CommandLine()->FindParm( "-syncoutput" ) != 0; // create a slave thread to do delayed VXConsole transactions ThreadId_t threadID; g_xbx_hDebugThread = CreateSimpleThread( _DebugThreadFunc, NULL, &threadID, 16*1024 ); ThreadSetDebugName( threadID, "DebugThread" ); ThreadSetAffinity( g_xbx_hDebugThread, XBOX_PROCESSOR_5 ); if ( bWaitForConnect ) { XBX_DebugString( XBX_CLR_DEFAULT, "Waiting For VXConsole Connection...\n" ); WaitForSingleObject( g_xbx_dbgValidEvent, INFINITE ); } }
uint InitMainThread() { ThreadSetDebugName( "MainThrd" ); #ifdef _WIN32 return ThreadGetCurrentId(); #elif _LINUX return pthread_self(); #endif }