MPSC task-queue that is handled by a single consumer loop. More...
#include <fiberqueue_threadpool.h>
Public Member Functions | |
| FiberQueue (unsigned queue_size=128) | |
| template<typename F > | |
| bool | TryAdd (F &&f) |
| template<typename F > | |
| bool | Add (F &&f) |
| Submits a callback into the queue. Should not be called after calling Shutdown(). More... | |
| template<typename F > | |
| auto | Await (F &&f) -> decltype(f()) |
| Sends f to consumer thread and waits for it to finish runnning. More... | |
| void | Shutdown () |
| Notifies Run() function to empty the queue and to exit. Does not block. | |
| void | Run () |
MPSC task-queue that is handled by a single consumer loop.
The loop is exposed as a function to incorporate into a thread or fiber of your choice.
Definition at line 20 of file fiberqueue_threadpool.h.
|
inline |
Submits a callback into the queue. Should not be called after calling Shutdown().
| F | - callback type |
| f | - callback object |
Definition at line 42 of file fiberqueue_threadpool.h.
|
inline |
Sends f to consumer thread and waits for it to finish runnning.
| F |
| f | - a callback |
Definition at line 67 of file fiberqueue_threadpool.h.
1.8.15