common taskScheduler: code refactoring

removed unnecessary code.
This commit is contained in:
Hermet Park 2020-11-11 13:55:46 +09:00 committed by GitHub
parent c2e1583e94
commit a71773f98d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 17 deletions

View file

@ -54,11 +54,8 @@ public:
{ {
if (!pending) return; if (!pending) return;
if (TaskScheduler::threads() > 0) {
unique_lock<mutex> lock(mtx); unique_lock<mutex> lock(mtx);
while (!ready) cv.wait(lock); while (!ready) cv.wait(lock);
}
pending = false; pending = false;
} }
@ -70,22 +67,16 @@ private:
{ {
run(tid); run(tid);
if (TaskScheduler::threads() > 0) {
{
lock_guard<mutex> lock(mtx); lock_guard<mutex> lock(mtx);
ready = true; ready = true;
}
cv.notify_one(); cv.notify_one();
} }
}
void prepare() void prepare()
{ {
if (TaskScheduler::threads() > 0) {
ready = false; ready = false;
pending = true; pending = true;
} }
}
friend class TaskSchedulerImpl; friend class TaskSchedulerImpl;
}; };