static void startWorker() { DENG_ASSERT(DMFluid_Driver() == NULL); DENG_ASSERT(worker == NULL); workerShouldStop = false; worker = Sys_StartThread(synthWorkThread, 0); }
/** * Sets up module state for running a busy task. After this the busy mode event * loop is started. The loop will run until the worker thread exits. */ static void beginTask(BusyTask* task) { DENG_ASSERT(task); if(!busyInited) { busy_Mutex = Sys_CreateMutex("BUSY_MUTEX"); } if(busyInited) { App_Error("Con_Busy: Already busy.\n"); } BusyVisual_PrepareResources(); Sys_Lock(busy_Mutex); busyDone = false; busyTaskEndedWithError = false; // This is now the current task. busyTask = task; Sys_Unlock(busy_Mutex); busyInited = true; de::ProgressWidget &prog = ClientWindow::main().busy().progress(); prog.show(); prog.setText(task->name); prog.setMode(task->mode & BUSYF_ACTIVITY? de::ProgressWidget::Indefinite : de::ProgressWidget::Ranged); // Start the busy worker thread, which will process the task in the // background while we keep the user occupied with nice animations. busyThread = Sys_StartThread(busyTask->worker, busyTask->workerData); Thread_SetCallback(busyThread, busyWorkerTerminated); busyTask->_startTime = Timer_RealSeconds(); }