Changeset View
Changeset View
Standalone View
Standalone View
source/ps/TaskManager.cpp
Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | |||||
WorkerThread::WorkerThread(TaskManager::Impl& taskManager) | WorkerThread::WorkerThread(TaskManager::Impl& taskManager) | ||||
: m_TaskManager(taskManager) | : m_TaskManager(taskManager) | ||||
{ | { | ||||
Start<WorkerThread, &WorkerThread::RunUntilDeath>(this); | Start<WorkerThread, &WorkerThread::RunUntilDeath>(this); | ||||
} | } | ||||
WorkerThread::~WorkerThread() | WorkerThread::~WorkerThread() | ||||
{ | { | ||||
{ | |||||
std::lock_guard guard{m_Mutex}; | |||||
m_Kill = true; | m_Kill = true; | ||||
} | |||||
m_ConditionVariable.notify_one(); | m_ConditionVariable.notify_one(); | ||||
if (m_Thread.joinable()) | if (m_Thread.joinable()) | ||||
m_Thread.join(); | m_Thread.join(); | ||||
} | } | ||||
void WorkerThread::Wake() | void WorkerThread::Wake() | ||||
{ | { | ||||
m_ConditionVariable.notify_one(); | m_ConditionVariable.notify_one(); | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator