summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2015-04-02 21:02:06 +0000
committerEric Fiselier <eric@efcs.ca>2015-04-02 21:02:06 +0000
commit4453d2185c43fafee3c74ad95ecbd87d8b2e97ef (patch)
treebd597384c7c281e40f2862bff9537639b876944d /libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp
parent48b475cbaa098095b47d220aa3503a275ee70982 (diff)
downloadbcm5719-llvm-4453d2185c43fafee3c74ad95ecbd87d8b2e97ef.tar.gz
bcm5719-llvm-4453d2185c43fafee3c74ad95ecbd87d8b2e97ef.zip
[libcxx] Fix bug in shared_timed_mutex that could cause a program to hang.
Summary: The summary of the bug, provided by Stephan T. Lavavej: In shared_timed_mutex::try_lock_until() (line 195 in 3.6.0), you need to deliver a notification. The scenario is: * There are N threads holding the shared lock. * One thread calls try_lock_until() to attempt to acquire the exclusive lock. It sets the "I want to write" bool/bit, then waits for the N readers to drain away. * K more threads attempt to acquire the shared lock, but they notice that someone said "I want to write", so they block on a condition_variable. * At least one of the N readers is stubborn and doesn't release the shared lock. * The wannabe-writer times out, gives up, and unsets the "I want to write" bool/bit. At this point, a notification (it needs to be notify_all) must be delivered to the condition_variable that the K wannabe-readers are waiting on. Otherwise, they can block forever without waking up. Reviewers: mclow.lists, jyasskin Reviewed By: jyasskin Subscribers: jyasskin, cfe-commits Differential Revision: http://reviews.llvm.org/D8796 llvm-svn: 233944
Diffstat (limited to 'libcxx/test/std/thread/thread.threads/thread.thread.class/thread.thread.constr/copy.fail.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud