void unpark() { utilities::thread::Mutex::LockGuard lg(mutex_); if(!sleeping_) return; wake_ = true; cond_.signal(); }
void unpause() { utilities::thread::Mutex::LockGuard guard(mutex_); // idle, just waiting for more work, ok, thats fine. if(state != cPaused) return; pause_ = false; condition_.signal(); }
void stop() { { utilities::thread::Mutex::LockGuard guard(mutex_); if(state == cStopped) return; stop_ = true; if(state == cIdle) { condition_.signal(); } else if(state == cPaused) { // TODO refactor common from unpause pause_ = false; condition_.signal(); } } join(); { utilities::thread::Mutex::LockGuard guard(mutex_); state = cStopped; } }
void add(BackgroundCompileRequest* req) { utilities::thread::Mutex::LockGuard guard(mutex_); pending_requests_.push_back(req); condition_.signal(); }