diff options
-rw-r--r-- | fnet/src/vespa/fnet/transport_thread.cpp | 24 | ||||
-rw-r--r-- | fnet/src/vespa/fnet/transport_thread.h | 6 |
2 files changed, 15 insertions, 15 deletions
diff --git a/fnet/src/vespa/fnet/transport_thread.cpp b/fnet/src/vespa/fnet/transport_thread.cpp index 9758cff21e4..e351202ef0a 100644 --- a/fnet/src/vespa/fnet/transport_thread.cpp +++ b/fnet/src/vespa/fnet/transport_thread.cpp @@ -116,7 +116,7 @@ FNET_TransportThread::PostEvent(FNET_ControlPacket *cpacket, { size_t qLen; { - std::unique_lock<std::mutex> guard(_qLock); + std::unique_lock<std::mutex> guard(_lock); if (IsShutDown()) { guard.unlock(); SafeDiscardEvent(cpacket, context); @@ -217,9 +217,9 @@ FNET_TransportThread::FNET_TransportThread(FNET_Transport &owner_in) _selector(), _queue(), _myQueue(), - _qLock(), _lock(), - _cond(), + _shutdownLock(), + _shutdownCond(), _pseudo_thread(), _started(false), _shutdown(false), @@ -233,9 +233,9 @@ FNET_TransportThread::FNET_TransportThread(FNET_Transport &owner_in) FNET_TransportThread::~FNET_TransportThread() { { - std::lock_guard<std::mutex> guard(_lock); + std::lock_guard<std::mutex> guard(_shutdownLock); } - if (_started.load(std::memory_order_relaxed) && !_finished) { + if (_started.load() && !_finished) { LOG(error, "Transport: delete called on active object!"); } else { std::lock_guard guard(_pseudo_thread); @@ -355,7 +355,7 @@ FNET_TransportThread::ShutDown(bool waitFinished) { bool wasEmpty = false; { - std::lock_guard<std::mutex> guard(_qLock); + std::lock_guard<std::mutex> guard(_lock); if (!IsShutDown()) { _shutdown.store(true, std::memory_order_relaxed); wasEmpty = _queue.IsEmpty_NoLock(); @@ -376,10 +376,10 @@ FNET_TransportThread::WaitFinished() if (_finished) return; - std::unique_lock<std::mutex> guard(_lock); + std::unique_lock<std::mutex> guard(_shutdownLock); _waitFinished = true; while (!_finished) - _cond.wait(guard); + _shutdownCond.wait(guard); } @@ -398,7 +398,7 @@ void FNET_TransportThread::handle_wakeup_events() { { - std::lock_guard<std::mutex> guard(_qLock); + std::lock_guard<std::mutex> guard(_lock); _queue.FlushPackets_NoLock(&_myQueue); } @@ -516,7 +516,7 @@ void FNET_TransportThread::endEventLoop() { // flush event queue { - std::lock_guard<std::mutex> guard(_qLock); + std::lock_guard<std::mutex> guard(_lock); _queue.FlushPackets_NoLock(&_myQueue); } @@ -549,10 +549,10 @@ FNET_TransportThread::endEventLoop() { _myQueue.IsEmpty_NoLock()); { - std::lock_guard<std::mutex> guard(_lock); + std::lock_guard<std::mutex> guard(_shutdownLock); _finished = true; if (_waitFinished) { - _cond.notify_all(); + _shutdownCond.notify_all(); } } diff --git a/fnet/src/vespa/fnet/transport_thread.h b/fnet/src/vespa/fnet/transport_thread.h index aa03c8d300e..be2a36419c8 100644 --- a/fnet/src/vespa/fnet/transport_thread.h +++ b/fnet/src/vespa/fnet/transport_thread.h @@ -43,9 +43,9 @@ private: Selector _selector; // I/O event generator FNET_PacketQueue_NoLock _queue; // outer event queue FNET_PacketQueue_NoLock _myQueue; // inner event queue - std::mutex _qLock; // protects the Q - std::mutex _lock; // used for synchronization during shutdown - std::condition_variable _cond; // used for synchronization during shutdown + std::mutex _lock; // protects the Q + std::mutex _shutdownLock; // used for synchronization during shutdown + std::condition_variable _shutdownCond; // used for synchronization during shutdown std::recursive_mutex _pseudo_thread; // used after transport thread has shut down std::atomic<bool> _started; // event loop started ? std::atomic<bool> _shutdown; // should stop event loop ? |