-\r
- template<typename Func>\r
- auto try_begin_invoke(Func&& func, task_priority priority = normal_priority) -> boost::unique_future<decltype(func())> // noexcept\r
- {\r
- // Create a move on copy adaptor to avoid copying the functor into the queue, tbb::concurrent_queue does not support move semantics.\r
- auto task_adaptor = make_move_on_copy(create_task(func));\r
- \r
- auto future = task_adaptor.value.get_future();\r
-\r
- if(priority == normal_priority || execution_queue_[normal_priority].try_push(nullptr))\r
- { \r
- execution_queue_[priority].try_push([=]\r
- {\r
- try{task_adaptor.value();}\r
- catch(boost::task_already_started&){}\r
- catch(...){CASPAR_LOG_CURRENT_EXCEPTION();}\r
- });\r
- }\r
- \r
- return std::move(future); \r
- }\r
-\r