diff options
Diffstat (limited to 'lib/worker.h')
-rw-r--r-- | lib/worker.h | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/lib/worker.h b/lib/worker.h index 7cd06f9..136c50e 100644 --- a/lib/worker.h +++ b/lib/worker.h @@ -1,19 +1,17 @@ #pragma once +#include <deque> +#include <memory> +#include <mutex> +#include <semaphore> +#include <special_members.hpp> +#include <thread> #include <utility> -class Work; - -#if __cpp_lib_semaphore -# include <deque> -# include <memory> -# include <mutex> -# include <semaphore> -# include <special_members.hpp> -# include <thread> -# include <vector> +#include <vector> +class Work; class Worker { -public: +private: Worker(); ~Worker(); @@ -42,19 +40,6 @@ private: ToDo todo; std::counting_semaphore<16> todoLen; std::mutex todoMutex; -}; - -#else -class Worker { -public: - template<typename T, typename... Params> - void - addWork(Params &&... params) - requires std::is_base_of_v<Work, T> - { - T(std::forward<Params>(params)...).doWork(); - } + static Worker instance; }; - -#endif |