| 38 | /// Post a task to the pool. |
| 39 | template <typename FunctorT, typename ResultT = typename std::result_of<FunctorT()>::type> |
| 40 | std::future<ResultT> Post(FunctorT &&functor) { |
| 41 | auto task = std::packaged_task<ResultT()>(std::forward<FunctorT>(functor)); |
| 42 | auto future = task.get_future(); |
| 43 | _io_context.post(carla::MoveHandler(task)); |
| 44 | return future; |
| 45 | } |
| 46 | |
| 47 | /// Launch threads to run tasks asynchronously. Launch specific number of |
| 48 | /// threads if @a worker_threads is provided, otherwise use all available |