/** * Exits the busy mode event loop. Called in the main thread, does not return * until the worker thread is stopped. */ void exitEventLoop() { DENG_ASSERT_IN_MAIN_THREAD(); DENG_ASSERT(eventLoop); DENG_ASSERT(busyThread); busyDone = true; // Make sure the worker finishes before we continue. int result = Sys_WaitThread(busyThread, busy().endedWithError()? 100 : 5000, nullptr); busyThread = nullptr; eventLoop->exit(result); }
static void stopWorker() { DENG_ASSERT(DMFluid_Driver() == NULL); if(worker) { DSFLUIDSYNTH_TRACE("stopWorker: Stopping thread " << worker); workerShouldStop = true; Sys_WaitThread(worker, 1000, NULL); worker = 0; DSFLUIDSYNTH_TRACE("stopWorker: Thread stopped."); } }
/** * Exits the busy mode event loop. Called in the main thread, does not return * until the worker thread is stopped. */ static void BusyMode_Exit(void) { int result; systhreadexitstatus_t status; DENG_ASSERT_IN_MAIN_THREAD(); busyDone = true; // Make sure the worker finishes before we continue. result = Sys_WaitThread(busyThread, busyTaskEndedWithError? 100 : 5000, &status); busyThread = NULL; busyTask = NULL; stopEventLoopWithValue(result); }