Public Member Functions | |
ProactorPool (const ProactorPool &)=delete | |
void | operator= (const ProactorPool &)=delete |
ProactorPool (std::size_t pool_size=0) | |
void | Run (uint32_t ring_depth=256) |
void | Stop () |
Stops all io_context objects in the pool. More... | |
Proactor * | GetNextProactor () |
Get a Proactor to use. Thread-safe. | |
Proactor & | operator[] (size_t i) |
Proactor & | at (size_t i) |
size_t | size () const |
template<typename Func , AcceptArgsCheck< Func, Proactor * > = 0> | |
void | AsyncOnAll (Func &&func) |
Runs func in all IO threads asynchronously. More... | |
template<typename Func , AcceptArgsCheck< Func, unsigned, Proactor * > = 0> | |
void | AsyncOnAll (Func &&func) |
Runs func in all IO threads asynchronously. More... | |
template<typename Func , AcceptArgsCheck< Func, Proactor * > = 0> | |
void | AwaitOnAll (Func &&func) |
Runs the funcion in all IO threads asynchronously. Blocks until all the asynchronous calls return. More... | |
template<typename Func , AcceptArgsCheck< Func, unsigned, Proactor * > = 0> | |
void | AwaitOnAll (Func &&func) |
Blocks until all the asynchronous calls to func return. Func receives both the index and Proactor&. func must not block. More... | |
template<typename Func , AcceptArgsCheck< Func, unsigned, Proactor * > = 0> | |
void | AsyncFiberOnAll (Func &&func) |
Runs func in a fiber asynchronously. func must accept Proactor&. func may fiber-block. More... | |
template<typename Func , AcceptArgsCheck< Func, Proactor * > = 0> | |
void | AsyncFiberOnAll (Func &&func) |
Runs func in a fiber asynchronously. func must accept Proactor&. func may fiber-block. More... | |
template<typename Func , AcceptArgsCheck< Func, unsigned, Proactor * > = 0> | |
void | AwaitFiberOnAll (Func &&func) |
Runs func wrapped in fiber on all IO threads in parallel. func must accept Proactor&. func may fiber-block. More... | |
template<typename Func , AcceptArgsCheck< Func, Proactor * > = 0> | |
void | AwaitFiberOnAll (Func &&func) |
Runs func wrapped in fiber on all IO threads in parallel. func must accept Proactor*. func may fiber-block. More... | |
Proactor * | GetLocalProactor () |
absl::string_view | GetString (absl::string_view source) |
Definition at line 21 of file proactor_pool.h.
|
explicit |
Constructs io_context pool with number of threads equal to 'pool_size'. pool_size = 0 chooses automatically pool size equal to number of cores in the system.
Definition at line 19 of file proactor_pool.cc.
|
inline |
Runs func
in a fiber asynchronously. func must accept Proactor&. func may fiber-block.
func | 'func' callback runs inside a wrapping fiber. |
Definition at line 141 of file proactor_pool.h.
|
inline |
Runs func
in a fiber asynchronously. func must accept Proactor&. func may fiber-block.
func | 'func' callback runs inside a wrapping fiber. |
Definition at line 157 of file proactor_pool.h.
|
inline |
Runs func in all IO threads asynchronously.
The task must be CPU-only non IO-blocking code because it runs directly in IO-fiber. AsyncOnAll runs asynchronously and will exit before the task finishes. The 'func' must accept Proactor& as its argument.
Definition at line 71 of file proactor_pool.h.
|
inline |
Runs func in all IO threads asynchronously.
The task must be CPU-only non IO-blocking code because it runs directly in IO-loop. AsyncOnAll runs asynchronously and will exit once func is submitted but before it has finished running. The 'func' must accept unsigned int (io context index) and Proactor& as its arguments.
Definition at line 89 of file proactor_pool.h.
|
inline |
Runs func
wrapped in fiber on all IO threads in parallel. func must accept Proactor&. func may fiber-block.
func | Waits for all the callbacks to finish. |
Definition at line 172 of file proactor_pool.h.
|
inline |
Runs func
wrapped in fiber on all IO threads in parallel. func must accept Proactor*. func may fiber-block.
func | Waits for all the callbacks to finish. |
Definition at line 192 of file proactor_pool.h.
|
inline |
Runs the funcion in all IO threads asynchronously. Blocks until all the asynchronous calls return.
Func must accept "Proactor&" and it should not block.
Definition at line 105 of file proactor_pool.h.
|
inline |
Blocks until all the asynchronous calls to func return. Func receives both the index and Proactor&. func must not block.
Definition at line 121 of file proactor_pool.h.
void util::uring::ProactorPool::Run | ( | uint32_t | ring_depth = 256 | ) |
Starts running all Proactor objects in the pool. Blocks until all the proactors up and spinning.
Definition at line 36 of file proactor_pool.cc.
void util::uring::ProactorPool::Stop | ( | ) |
Stops all io_context objects in the pool.
Waits for all the threads to finish. Requires that Run has been called. Blocks the current thread until all the pool threads exited.
Definition at line 68 of file proactor_pool.cc.