1
0
Fork 0

Fix shutdown bug around ClusterComm and ClusterCommThread.

This commit is contained in:
Max Neunhoeffer 2017-02-09 12:37:49 +01:00
parent ffd617103f
commit 226fd54db2
1 changed files with 7 additions and 6 deletions

View File

@ -801,14 +801,15 @@ ClusterCommThread::~ClusterCommThread() { shutdown(); }
////////////////////////////////////////////////////////////////////////////////
void ClusterCommThread::beginShutdown() {
// Note that this is called from the destructor of the ClusterComm singleton
// object. This means that our pointer _cc is still valid and the condition
// variable in it is still OK. However, this method is called from a
// different thread than the ClusterCommThread. Therefore we can still
// use the condition variable to wake up the ClusterCommThread.
Thread::beginShutdown();
auto cc = ClusterComm::instance();
if (cc != nullptr) {
CONDITION_LOCKER(guard, cc->somethingToSend);
guard.signal();
}
CONDITION_LOCKER(guard, _cc->somethingToSend);
guard.signal();
}
////////////////////////////////////////////////////////////////////////////////