Skip to content

Commit 39cffd0

Browse files
Update lld/MachO/Driver.cpp
Co-authored-by: Daniel Rodríguez Troitiño <[email protected]>
1 parent 5901e7d commit 39cffd0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lld/MachO/Driver.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,19 +313,18 @@ class SerialBackgroundQueue {
313313
queue.emplace_back(std::move(work));
314314
if (!running)
315315
running = new std::thread([&]() {
316-
bool shouldPop = false;
317316
while (true) {
318317
mutex.lock();
319-
if (shouldPop)
320-
queue.pop_front();
321318
if (queue.empty()) {
322319
mutex.unlock();
323320
break;
324321
}
325322
auto work = std::move(queue.front());
326-
shouldPop = true;
327323
mutex.unlock();
328324
work();
325+
mutex.lock();
326+
queue.pop_front();
327+
mutex.unlock();
329328
}
330329
});
331330
}

0 commit comments

Comments
 (0)