File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 9
9
#include < assert.h>
10
10
#include < utility>
11
11
12
- CScheduler::CScheduler () : nThreadsServicingQueue( 0 ), stopRequested( false ), stopWhenEmpty( false )
12
+ CScheduler::CScheduler ()
13
13
{
14
14
}
15
15
16
16
CScheduler::~CScheduler ()
17
17
{
18
18
assert (nThreadsServicingQueue == 0 );
19
+ if (stopWhenEmpty) assert (taskQueue.empty ());
19
20
}
20
21
21
22
Original file line number Diff line number Diff line change @@ -86,9 +86,9 @@ class CScheduler
86
86
mutable Mutex newTaskMutex;
87
87
std::condition_variable newTaskScheduled;
88
88
std::multimap<std::chrono::system_clock::time_point, Function> taskQueue GUARDED_BY (newTaskMutex);
89
- int nThreadsServicingQueue GUARDED_BY (newTaskMutex);
90
- bool stopRequested GUARDED_BY (newTaskMutex);
91
- bool stopWhenEmpty GUARDED_BY (newTaskMutex);
89
+ int nThreadsServicingQueue GUARDED_BY (newTaskMutex){ 0 } ;
90
+ bool stopRequested GUARDED_BY (newTaskMutex){ false } ;
91
+ bool stopWhenEmpty GUARDED_BY (newTaskMutex){ false } ;
92
92
bool shouldStop () const EXCLUSIVE_LOCKS_REQUIRED(newTaskMutex) { return stopRequested || (stopWhenEmpty && taskQueue.empty ()); }
93
93
};
94
94
You can’t perform that action at this time.
0 commit comments