[PATCH] D18811: Fix a race condition in support library ThreadPoolBy running TSAN on some code using the ThreadPool it was discovered that thethreads in the pool can pop tasks off the queue at the same time the "wait"routine is trying to check if the task...

Jason Henline via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 5 17:51:02 PDT 2016


jhen created this revision.
jhen added a reviewer: jlebar.
jhen added a subscriber: llvm-commits.

...queue is empty. Part of the reason this
is happening is that there are two mutexes guarding the shared mutable state
and the threads hold one while the "wait" routine holds the other. This patch
aims to fix this problem by removing one of the mutexes and by using only one
mutex to control access to the shared mutable state.

Fix a race condition in support library ThreadPool

http://reviews.llvm.org/D18811

Files:
  include/llvm/Support/ThreadPool.h
  lib/Support/ThreadPool.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18811.52754.patch
Type: text/x-patch
Size: 4098 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160406/795930dd/attachment-0001.bin>


More information about the llvm-commits mailing list