Access WorkQueue::running only within the cs lock.

This removes a "race" between Interrupt() and Run(), though it
should not effect any of our supported platforms.
This commit is contained in:
Matt Corallo 2017-02-03 13:48:48 -05:00
parent 1c2edd9f67
commit 7b2d96b634
1 changed files with 1 additions and 1 deletions

View File

@ -118,7 +118,7 @@ public:
void Run() void Run()
{ {
ThreadCounter count(*this); ThreadCounter count(*this);
while (running) { while (true) {
std::unique_ptr<WorkItem> i; std::unique_ptr<WorkItem> i;
{ {
std::unique_lock<std::mutex> lock(cs); std::unique_lock<std::mutex> lock(cs);