From c964fd34ba2297a9643be66a91bec963bf302646 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Wed, 11 Nov 2020 13:55:46 +0900 Subject: [PATCH] common taskScheduler: code refactoring removed unnecessary code. Change-Id: I0e02fa8c2d8e33678b42bd88412b562afd551b86 --- src/examples/Stress.cpp | 2 +- src/lib/tvgTaskScheduler.h | 23 +++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/examples/Stress.cpp b/src/examples/Stress.cpp index 4019b05..235d563 100644 --- a/src/examples/Stress.cpp +++ b/src/examples/Stress.cpp @@ -227,4 +227,4 @@ int main(int argc, char **argv) cout << "engine is not supported" << endl; } return 0; -} \ No newline at end of file +} diff --git a/src/lib/tvgTaskScheduler.h b/src/lib/tvgTaskScheduler.h index 73f8280..7b06679 100644 --- a/src/lib/tvgTaskScheduler.h +++ b/src/lib/tvgTaskScheduler.h @@ -54,11 +54,8 @@ public: { if (!pending) return; - if (TaskScheduler::threads() > 0) { - unique_lock lock(mtx); - while (!ready) cv.wait(lock); - } - + unique_lock lock(mtx); + while (!ready) cv.wait(lock); pending = false; } @@ -70,21 +67,15 @@ private: { run(tid); - if (TaskScheduler::threads() > 0) { - { - lock_guard lock(mtx); - ready = true; - } - cv.notify_one(); - } + lock_guard lock(mtx); + ready = true; + cv.notify_one(); } void prepare() { - if (TaskScheduler::threads() > 0) { - ready = false; - pending = true; - } + ready = false; + pending = true; } friend class TaskSchedulerImpl; -- 2.7.4