executor& operator=(const executor&);\r
\r
typedef tbb::concurrent_priority_queue<priority_function> function_queue_t;\r
-\r
+ \r
+ const std::wstring name_;\r
tbb::atomic<bool> is_running_;\r
boost::thread thread_; \r
function_queue_t execution_queue_;\r
tbb::concurrent_bounded_queue<int> semaphore_;\r
\r
public: \r
- executor(const std::wstring& name) // noexcept\r
+ executor(const std::wstring& name)\r
+ : name_(name)\r
{\r
- name; // TODO: Use to set thread name.\r
is_running_ = true;\r
thread_ = boost::thread([this]{run();});\r
}\r
\r
- virtual ~executor() // noexcept\r
+ virtual ~executor()\r
{\r
stop();\r
thread_.join();\r
template<typename Func>\r
auto begin_invoke(Func&& func, task_priority priority = task_priority::normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
{ \r
- if(execution_queue_.size() > 256)\r
- BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("executor overflow."));\r
+ if(execution_queue_.size() > 128)\r
+ BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("executor overflow.") << source_info(name_));\r
\r
if(!is_running_)\r
- BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("executor not running."));\r
+ BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("executor not running.") << source_info(name_));\r
\r
typedef typename std::remove_reference<Func>::type function_type;\r
typedef decltype(func()) result_type;\r
return begin_invoke(std::forward<Func>(func), prioriy).get();\r
}\r
\r
- void yield() // noexcept\r
+ void yield()\r
{\r
if(!is_current())\r
- BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Executor can only yield inside of thread context."));\r
+ BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Executor can only yield inside of thread context.") << source_info(name_));\r
\r
int dummy;\r
semaphore_.pop(dummy);\r
func();\r
}\r
\r
- void set_capacity(std::size_t capacity) // noexcept\r
+ void set_capacity(std::size_t capacity)\r
{\r
semaphore_.set_capacity(capacity);\r
}\r