void mp_manager::run_system() { section* pSection = mp_manager::create_section(m_startup_section); if (!pSection) { assert(0 && "no startup section defined " ); return; } startup_section_config cfg = pSection->configure(); start_threads(cfg.m_thread_count); system_section bootstrap(0); bootstrap.start_self(m_startup_section); // system thread occupies thread 0 and we just started processing. bool result = true; for (int i = 0 ; i < m_threads.size() ; i ++ ) { m_threads[i]->m_handle = CreateEvent( NULL, TRUE, TRUE, NULL ); // system thread is ... system. we dont need any specific thread to start. if (i > 0 ) { result = result && _beginthread(&ThreadProc,0, m_threads[i])!=-1; } } ThreadProc( m_threads[0] ) ; }
INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { hInst = hInstance; ThreadProc(0); return 0; }
void TSThread::InternalThreadProc() { ResetEvent(m_hDoneEvent); try { ThreadProc(); } catch (LPWSTR pStr) { pStr = NULL; } SetEvent(m_hDoneEvent); }
void TSThread::InternalThreadProc() { ResetEvent(m_hDoneEvent); m_bThreadRunning=TRUE; try { ThreadProc(); } catch (LPWSTR pStr) { pStr = NULL; } SetEvent(m_hDoneEvent); m_bThreadRunning=FALSE; }
void ServiceMain(int argc, char* argv[]) { int error; ServiceStatus.dwServiceType = SERVICE_WIN32; ServiceStatus.dwCurrentState = SERVICE_START_PENDING; ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; ServiceStatus.dwWin32ExitCode = 0; ServiceStatus.dwServiceSpecificExitCode = 0; ServiceStatus.dwCheckPoint = 0; ServiceStatus.dwWaitHint = 0; hStatus = RegisterServiceCtrlHandler(SERVICE_NAME, (LPHANDLER_FUNCTION)ControlHandler); if (hStatus == (SERVICE_STATUS_HANDLE)0) { return; } ThreadProc(NULL); }
CGSHandler::CGSHandler() : m_threadDone(false) , m_drawCallCount(0) , m_pCLUT(nullptr) , m_pRAM(nullptr) , m_frameDump(nullptr) , m_loggingEnabled(true) { RegisterPreferences(); m_presentationParams.mode = static_cast<PRESENTATION_MODE>(CAppConfig::GetInstance().GetPreferenceInteger(PREF_CGSHANDLER_PRESENTATION_MODE)); m_presentationParams.windowWidth = 512; m_presentationParams.windowHeight = 384; m_pRAM = new uint8[RAMSIZE]; m_pCLUT = new uint16[CLUTENTRYCOUNT]; for(int i = 0; i < PSM_MAX; i++) { m_transferWriteHandlers[i] = &CGSHandler::TransferWriteHandlerInvalid; m_transferReadHandlers[i] = &CGSHandler::TransferReadHandlerInvalid; } m_transferWriteHandlers[PSMCT32] = &CGSHandler::TransferWriteHandlerGeneric<CGsPixelFormats::STORAGEPSMCT32>; m_transferWriteHandlers[PSMCT24] = &CGSHandler::TransferWriteHandlerPSMCT24; m_transferWriteHandlers[PSMCT16] = &CGSHandler::TransferWriteHandlerGeneric<CGsPixelFormats::STORAGEPSMCT16>; m_transferWriteHandlers[PSMCT16S] = &CGSHandler::TransferWriteHandlerGeneric<CGsPixelFormats::STORAGEPSMCT16S>; m_transferWriteHandlers[PSMT8] = &CGSHandler::TransferWriteHandlerGeneric<CGsPixelFormats::STORAGEPSMT8>; m_transferWriteHandlers[PSMT4] = &CGSHandler::TransferWriteHandlerPSMT4; m_transferWriteHandlers[PSMT8H] = &CGSHandler::TransferWriteHandlerPSMT8H; m_transferWriteHandlers[PSMT4HL] = &CGSHandler::TransferWriteHandlerPSMT4H<24, 0x0F000000>; m_transferWriteHandlers[PSMT4HH] = &CGSHandler::TransferWriteHandlerPSMT4H<28, 0xF0000000>; m_transferReadHandlers[PSMCT32] = &CGSHandler::TransferReadHandlerGeneric<CGsPixelFormats::STORAGEPSMCT32>; m_transferReadHandlers[PSMT8] = &CGSHandler::TransferReadHandlerGeneric<CGsPixelFormats::STORAGEPSMT8>; ResetBase(); m_thread = std::thread([&] () { ThreadProc(); }); }