![]() |
PRCYCoin
2.0.0.7rc1
P2P Digital Currency
|
Simple work queue for distributing work over multiple threads. More...
Classes | |
| class | ThreadCounter |
| RAII object to keep track of number of running worker threads. More... | |
Public Member Functions | |
| WorkQueue (size_t maxDepth) | |
| ~WorkQueue () | |
| bool | Enqueue (WorkItem *item) |
| Enqueue a work item. More... | |
| void | Run () |
| Thread function. More... | |
| void | Interrupt () |
| Interrupt and exit loops. More... | |
| void | WaitExit () |
| Wait for worker threads to exit. More... | |
| size_t | Depth () |
| Return current depth of queue. More... | |
Private Attributes | |
| std::mutex | cs |
| Mutex protects entire object. More... | |
| std::condition_variable | cond |
| std::deque< WorkItem * > | queue |
| bool | running |
| size_t | maxDepth |
| int | numThreads |
Simple work queue for distributing work over multiple threads.
Work items are simply callable objects.
Definition at line 69 of file httpserver.cpp.
Definition at line 100 of file httpserver.cpp.
Definition at line 108 of file httpserver.cpp.
|
inline |
Return current depth of queue.
Definition at line 161 of file httpserver.cpp.
|
inline |
Enqueue a work item.
Definition at line 116 of file httpserver.cpp.
|
inline |
Interrupt and exit loops.
Definition at line 146 of file httpserver.cpp.
|
inline |
Thread function.
Definition at line 127 of file httpserver.cpp.
|
inline |
Wait for worker threads to exit.
Definition at line 153 of file httpserver.cpp.
|
private |
Definition at line 74 of file httpserver.cpp.
|
private |
Mutex protects entire object.
Definition at line 73 of file httpserver.cpp.
|
private |
Definition at line 78 of file httpserver.cpp.
|
private |
Definition at line 79 of file httpserver.cpp.
|
private |
Definition at line 76 of file httpserver.cpp.
|
private |
Definition at line 77 of file httpserver.cpp.
1.8.17