int SimulatorBaseThread :: InitThread(int instanceindex, int globalThreadID) { //LogMessageL("[HTTP:%d] Address: %08X", instanceindex, this); ResetValues(false); InternalIndex = instanceindex; GlobalThreadID = globalThreadID; //Set to active now because the thread might launch and quit //before it gets set to active later. /* HANDLE h = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE)SimulatorBaseThreadProc, this, 0, &ThreadID); if(h == NULL) { isActive = false; LogMessageL("[SimB] Could not create thread."); return 1; } */ int r = Platform_CreateThread(0, (void*)SimulatorBaseThreadProc, this, &ThreadID); if(r == 0) { isActive = false; g_Logs.simulator->error("[SimB] Could not create thread."); return 1; } return 0; }
void PacketManager::LaunchThread(void) { if (Platform_CreateThread(0, (void*) ThreadProc, &g_PacketManager, NULL) == 0) g_Logs.server->error( "PacketManager::LaunchThread: error creating thread"); else g_Logs.server->info("PacketManager::LaunchThread: successful"); }
void Scheduler::Init() { /* Setup thread pool */ for(int i = 0 ; i < POOL_SIZE; i++) { PooledWorker *worker = new PooledWorker(i); if(Platform_CreateThread(0, (void*)worker->ThreadProc, worker, NULL) == 0) { g_Logs.server->error("Failed to create worker thread %v", i); } else { workers.push_back(worker); } } }
void PacketManager :: LaunchThread(void) { int res = Platform_CreateThread(0, (void*)ThreadProc, &g_PacketManager, NULL); g_Log.AddMessageFormatW(MSG_ERROR, "PacketManager::LaunchThread: %s ", (res == 0) ? "error creating thread" : "successful"); }