Changeset View
Changeset View
Standalone View
Standalone View
src/httpserver.cpp
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Simple work queue for distributing work over multiple threads. | * Simple work queue for distributing work over multiple threads. | ||||
* Work items are simply callable objects. | * Work items are simply callable objects. | ||||
*/ | */ | ||||
template <typename WorkItem> class WorkQueue { | template <typename WorkItem> class WorkQueue { | ||||
private: | private: | ||||
/** Mutex protects entire object */ | /** Mutex protects entire object */ | ||||
CWaitableCriticalSection cs; | Mutex cs; | ||||
std::condition_variable cond; | std::condition_variable cond; | ||||
std::deque<std::unique_ptr<WorkItem>> queue; | std::deque<std::unique_ptr<WorkItem>> queue; | ||||
bool running; | bool running; | ||||
size_t maxDepth; | size_t maxDepth; | ||||
public: | public: | ||||
explicit WorkQueue(size_t _maxDepth) : running(true), maxDepth(_maxDepth) {} | explicit WorkQueue(size_t _maxDepth) : running(true), maxDepth(_maxDepth) {} | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 585 Lines • Show Last 20 Lines |