4 #include <condition_variable> 20 for (
size_t i = 0; i < numThreads; ++i) {
41 std::unique_lock<std::mutex> lock(
_mutex);
49 std::unique_lock<std::mutex> lock(
_mutex);
50 _cv.wait(lock, [
this] {
61 }
catch (
const std::exception& ex) {
63 const std::string msg =
64 std::string(
"Caught unhandled exception in calback_queue") + ex.what();
76 std::condition_variable
_cv;
CallbackQueue(LogCallback logCallback, size_t numThreads=1)
std::deque< std::function< void(void)> > _callbackQueue
std::condition_variable _cv
std::function< void(WebSocketLogLevel, char const *)> LogCallback
void addCallback(std::function< void(void)> cb)
std::atomic< bool > _quit
std::vector< std::thread > _workerThreads