[PATCH] D48240: Try again to implement a FIFO task queue

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 15 17:09:55 PDT 2018


zturner updated this revision to Diff 151590.
zturner added a comment.

Added 2 more tests, the first of which exposed a bug in the `wait()` function.  All the `wait()` function was doing was joining the work thread, but this is incorrect.   What it's supposed to do is simply drain the queue.  i.e. keep processing work until the queue is empty.  It's not supposed to join the thread.  Joining the thread doesn't work anyway since we weren't setting the `EnableFlag` to be false, so this method was deadlocking.

To fix this I had to borrow some more code from `ThreadPool`, but all tests now pass both with `LLVM_ENABLE_THREADS=0` and `LLVM_ENABLE_THREADS=1`.


https://reviews.llvm.org/D48240

Files:
  llvm/include/llvm/Support/TaskQueue.h
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/TaskQueue.cpp
  llvm/unittests/Support/CMakeLists.txt
  llvm/unittests/Support/TaskQueueTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48240.151590.patch
Type: text/x-patch
Size: 12310 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180616/596f77f4/attachment.bin>


More information about the llvm-commits mailing list