diff options
Diffstat (limited to 'net/Socket.cpp')
-rw-r--r-- | net/Socket.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/Socket.cpp b/net/Socket.cpp index 8acd98ba22..208efc3c9c 100644 --- a/net/Socket.cpp +++ b/net/Socket.cpp @@ -66,6 +66,7 @@ SocketPoll::SocketPoll(const std::string& threadName) _stop(false), _threadStarted(false), _threadFinished(false), + _runOnClientThread(false), _owner(std::this_thread::get_id()) { // Create the wakeup fd. @@ -109,8 +110,10 @@ SocketPoll::~SocketPoll() _wakeup[1] = -1; } -void SocketPoll::startThread() +bool SocketPoll::startThread() { + assert(!_runOnClientThread); + if (!_threadStarted) { _threadStarted = true; @@ -119,6 +122,7 @@ void SocketPoll::startThread() try { _thread = std::thread(&SocketPoll::pollingThreadEntry, this); + return true; } catch (const std::exception& exc) { @@ -126,6 +130,8 @@ void SocketPoll::startThread() _threadStarted = false; } } + + return false; } void SocketPoll::joinThread() |