Improve RoutingWorker utilities
Added an overload to execute_concurrently that takes an std::function as a parameter and added a const version of operator* for rworker_local. Also removed the std::move of the return value in rworker_local::values as it can prevent RVO from taking place.
This commit is contained in:
@ -780,6 +780,13 @@ size_t RoutingWorker::execute_concurrently(Task& task)
|
||||
return sem.wait_n(RoutingWorker::broadcast(&task, &sem));
|
||||
}
|
||||
|
||||
// static
|
||||
size_t RoutingWorker::execute_concurrently(std::function<void()> func)
|
||||
{
|
||||
Semaphore sem;
|
||||
return sem.wait_n(RoutingWorker::broadcast(func, &sem, EXECUTE_AUTO));
|
||||
}
|
||||
|
||||
// static
|
||||
size_t RoutingWorker::broadcast_message(uint32_t msg_id, intptr_t arg1, intptr_t arg2)
|
||||
{
|
||||
|
Reference in New Issue
Block a user