MOTION
0.01
Framework for mixed-protocol multi-party computation
|
Go to the documentation of this file.
21 #ifndef FIBER_THREAD_POOL_HPP
22 #define FIBER_THREAD_POOL_HPP
43 using task_t = std::function<void()>;
53 FiberThreadPool(std::size_t number_of_workers, std::size_t number_of_tasks = 0,
54 bool suspend_scheduler =
true);
73 void create_threads();
75 std::size_t number_of_workers_;
77 bool suspend_scheduler_;
78 std::unique_ptr<boost::fibers::buffered_channel<task_t>> task_queue_;
79 std::unique_ptr<boost::fibers::barrier> worker_barrier_;
80 std::vector<std::thread> worker_threads_;
81 std::shared_ptr<pool_ctx> pool_ctx_;
86 #endif // FIBER_THREAD_POOL_HPP
static std::shared_ptr< pool_ctx > create_pool_ctx(std::uint32_t, bool=false)
Definition: pooled_work_stealing.cpp:37
std::function< void()> task_t
Definition: fiber_thread_pool.hpp:43
void post(task_t task)
Definition: fiber_thread_pool.cpp:148
Definition: fiber_thread_pool.hpp:29
constexpr FiberStackAllocator kFiberStackAllocator
Definition: constants.h:84
Definition: pooled_work_stealing.cpp:21
void ThreadSetName(std::thread &thread, const std::string &name)
Definition: thread.cpp:29
static void worker_fctn(std::shared_ptr< pool_ctx > pool_ctx, boost::fibers::buffered_channel< FiberThreadPool::task_t > &task_queue, boost::fibers::barrier &barrier)
Definition: fiber_thread_pool.cpp:70
Definition: fiber_thread_pool.hpp:29
void enqueue(const T &item)
Definition: locked_fiber_queue.h:72
Definition: fiber_thread_pool.hpp:41
Definition: algorithm_description.cpp:35
FiberThreadPool(std::size_t number_of_workers, std::size_t number_of_tasks=0, bool suspend_scheduler=true)
Definition: fiber_thread_pool.cpp:44
~FiberThreadPool()
Definition: fiber_thread_pool.cpp:62
Definition: fiber_thread_pool.hpp:33
std::optional< T > dequeue() noexcept
Definition: locked_fiber_queue.h:97
constexpr std::size_t kFiberStackSize
Definition: constants.h:71
void close() noexcept
Definition: locked_fiber_queue.h:61
void join()
Definition: fiber_thread_pool.cpp:140
Definition: locked_fiber_queue.h:40
constexpr bool kDebug
Definition: config.h:36