diff options
Diffstat (limited to 'thirdparty/thorvg/src/renderer/tvgTaskScheduler.h')
-rw-r--r-- | thirdparty/thorvg/src/renderer/tvgTaskScheduler.h | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/thirdparty/thorvg/src/renderer/tvgTaskScheduler.h b/thirdparty/thorvg/src/renderer/tvgTaskScheduler.h index 483e084880..58918e88f0 100644 --- a/thirdparty/thorvg/src/renderer/tvgTaskScheduler.h +++ b/thirdparty/thorvg/src/renderer/tvgTaskScheduler.h @@ -25,22 +25,13 @@ #include <mutex> #include <condition_variable> + #include "tvgCommon.h" #include "tvgInlist.h" -namespace tvg -{ - -struct Task; +namespace tvg { -struct TaskScheduler -{ - static unsigned threads(); - static void init(unsigned threads); - static void term(); - static void request(Task* task); - static void async(bool on); -}; +#ifdef THORVG_THREAD_SUPPORT struct Task { @@ -86,7 +77,36 @@ private: friend struct TaskSchedulerImpl; }; -} +#else //THORVG_THREAD_SUPPORT + +struct Task +{ +public: + INLIST_ITEM(Task); + + virtual ~Task() = default; + void done() {} + +protected: + virtual void run(unsigned tid) = 0; + +private: + friend struct TaskSchedulerImpl; +}; + +#endif //THORVG_THREAD_SUPPORT + + +struct TaskScheduler +{ + static uint32_t threads(); + static void init(uint32_t threads); + static void term(); + static void request(Task* task); + static void async(bool on); +}; + +} //namespace #endif //_TVG_TASK_SCHEDULER_H_ |