1
0
Fork 0

sanity check for stopped WorkMonitor

This commit is contained in:
Frank Celler 2016-02-23 23:07:08 +01:00
parent 8edc06daf3
commit 017d5fa904
1 changed files with 10 additions and 2 deletions

View File

@ -118,7 +118,7 @@ WorkMonitor::WorkMonitor() : Thread("WorkMonitor") {}
////////////////////////////////////////////////////////////////////////////////
void WorkMonitor::freeWorkDescription(WorkDescription* desc) {
if (WORK_MONITOR_STOPPED) {
if (WORK_MONITOR_STOPPED.load()) {
deleteWorkDescription(desc, true);
} else {
FREEABLE_WORK_DESCRIPTION.push(desc);
@ -130,6 +130,10 @@ void WorkMonitor::freeWorkDescription(WorkDescription* desc) {
////////////////////////////////////////////////////////////////////////////////
void WorkMonitor::pushThread(Thread* thread) {
if (WORK_MONITOR_STOPPED.load()) {
return;
}
TRI_ASSERT(thread != nullptr);
TRI_ASSERT(Thread::CURRENT_THREAD == nullptr);
Thread::CURRENT_THREAD = thread;
@ -154,6 +158,10 @@ void WorkMonitor::pushThread(Thread* thread) {
////////////////////////////////////////////////////////////////////////////////
void WorkMonitor::popThread(Thread* thread) {
if (WORK_MONITOR_STOPPED.load()) {
return;
}
TRI_ASSERT(thread != nullptr);
WorkDescription* desc = deactivateWorkDescription();
@ -399,7 +407,7 @@ void WorkMonitor::run() {
// indicate that we stopped the work monitor, freeWorkDescription
// should directly delete old entries
WORK_MONITOR_STOPPED = true;
WORK_MONITOR_STOPPED.store(true);
// cleanup old entries
WorkDescription* desc;