thread accepting connections can be cancelled/stopped externally

This commit is contained in:
Benjamin Sergeant
2019-01-01 16:11:27 -08:00
parent ead54d6c37
commit 7c4f14f941
3 changed files with 34 additions and 6 deletions

View File

@ -13,6 +13,7 @@
#include <mutex>
#include <functional>
#include <memory>
#include <condition_variable>
#include "IXWebSocket.h"
@ -29,6 +30,7 @@ namespace ix
void setOnConnectionCallback(const OnConnectionCallback& callback);
void start();
void wait();
std::pair<bool, std::string> listen();
@ -54,6 +56,9 @@ namespace ix
std::atomic<bool> _stop;
std::thread _thread;
std::condition_variable _conditionVariable;
std::mutex _conditionVariableMutex;
const static std::string kDefaultHost;
// Methods