Skip to content

Commit

Permalink
Merge pull request #20009 from Dr15Jones/waitToDestroySerialTaskQueue
Browse files Browse the repository at this point in the history
Wait in destructor of SerialTaskQueue
  • Loading branch information
cmsbuild committed Aug 2, 2017
2 parents 1b89497 + 9fbd9bb commit 753afe1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions FWCore/Concurrency/interface/SerialTaskQueue.h
Expand Up @@ -70,6 +70,8 @@ namespace edm {
m_pauseCount{0}
{ }

~SerialTaskQueue();

// ---------- const member functions ---------------------
/// Checks to see if the queue has been paused.
/**\return true if the queue is paused
Expand Down
10 changes: 10 additions & 0 deletions FWCore/Concurrency/src/SerialTaskQueue.cc
Expand Up @@ -23,6 +23,16 @@ using namespace edm;
//
// member functions
//
SerialTaskQueue::~SerialTaskQueue()
{
//be certain all tasks have completed
bool isEmpty = m_tasks.empty();
bool isTaskChosen = m_taskChosen;
if ( (not isEmpty and not isPaused()) or isTaskChosen) {
pushAndWait([]() {return;});
}
}

bool
SerialTaskQueue::resume() {
if(0==--m_pauseCount) {
Expand Down

0 comments on commit 753afe1

Please sign in to comment.