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 (TaskScheduler::threads() > 0) {
unique_lock<mutex> lock(mtx);
while (!ready) cv.wait(lock);
}
unique_lock<mutex> lock(mtx);
while (!ready) cv.wait(lock);
pending = false;
}
@ -70,21 +67,15 @@ private:
{
run(tid);
if (TaskScheduler::threads() > 0) {
{
lock_guard<mutex> lock(mtx);
ready = true;
}
cv.notify_one();
}
lock_guard<mutex> lock(mtx);
ready = true;
cv.notify_one();
}
void prepare()
{
if (TaskScheduler::threads() > 0) {
ready = false;
pending = true;
}
ready = false;
pending = true;
}
friend class TaskSchedulerImpl;