Commit 7512c1ae authored by knowledge4igor's avatar knowledge4igor

Tiny change in thread management

parent d59eee7b
......@@ -74,7 +74,7 @@ private:
Polling::Epoll poller;
Flags<Options> options_;
std::unique_ptr<std::thread> acceptThread;
std::thread acceptThread;
size_t workers_;
std::shared_ptr<Transport> transport_;
......
......@@ -99,8 +99,10 @@ Listener::Listener(const Address& address)
}
Listener::~Listener() {
if (isBound()) shutdown();
if (acceptThread) acceptThread->join();
if (isBound())
shutdown();
if (acceptThread.joinable())
acceptThread.join();
}
void
......@@ -243,7 +245,7 @@ Listener::run() {
void
Listener::runThreaded() {
shutdownFd.bind(poller);
acceptThread.reset(new std::thread([=]() { this->run(); }));
acceptThread = std::thread([=]() { this->run(); });
}
void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment