#pragma once\r
\r
#include "../except.h"\r
-#include "../log.h"\r
#include "../enum_class.h"\r
-#include "../os/windows/windows.h"\r
+#include "../log.h"\r
\r
#include <tbb/atomic.h>\r
#include <tbb/concurrent_queue.h>\r
};\r
typedef enum_class<task_priority_def> task_priority;\r
\r
-struct thread_priority_def\r
-{\r
- enum type\r
- {\r
- high_priority_class,\r
- above_normal_priority_class,\r
- normal_priority_class,\r
- below_normal_priority_class\r
- };\r
-};\r
-typedef enum_class<thread_priority_def> thread_priority;\r
-\r
class executor\r
{\r
executor(const executor&);\r
executor& operator=(const executor&);\r
-\r
- const std::string name_;\r
- boost::thread thread_;\r
- tbb::atomic<bool> is_running_;\r
+ \r
+ tbb::atomic<bool> is_running_;\r
+ boost::thread thread_;\r
\r
typedef tbb::concurrent_bounded_queue<std::function<void()>> function_queue;\r
function_queue execution_queue_[task_priority::priority_count];\r
return std::move(task);\r
}\r
\r
-public:\r
- \r
- explicit executor(const std::wstring& name) : name_(u8(name)) // noexcept\r
+public: \r
+ executor(const std::wstring& name) // noexcept\r
{\r
+ name; // TODO: Use to set thread name.\r
is_running_ = true;\r
thread_ = boost::thread([this]{run();});\r
}\r
{\r
execution_queue_[task_priority::normal_priority].set_capacity(capacity);\r
}\r
-\r
- void set_priority_class(thread_priority p)\r
- {\r
- begin_invoke([=]\r
- {\r
- if(p == thread_priority::high_priority_class)\r
- SetThreadPriority(GetCurrentThread(), HIGH_PRIORITY_CLASS);\r
- else if(p == thread_priority::above_normal_priority_class)\r
- SetThreadPriority(GetCurrentThread(), ABOVE_NORMAL_PRIORITY_CLASS);\r
- else if(p == thread_priority::normal_priority_class)\r
- SetThreadPriority(GetCurrentThread(), NORMAL_PRIORITY_CLASS);\r
- else if(p == thread_priority::below_normal_priority_class)\r
- SetThreadPriority(GetCurrentThread(), BELOW_NORMAL_PRIORITY_CLASS);\r
- });\r
- }\r
\r
void clear()\r
{ \r
void run() // noexcept\r
{\r
win32_exception::install_handler(); \r
- //detail::SetThreadName(GetCurrentThreadId(), name_.c_str());\r
while(is_running_)\r
{\r
try\r