On 4/1/15 10:09 PM, Eric Fiselier wrote:
Hi mclow.lists,

The summary of the bug, provided by STL:

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.

http://reviews.llvm.org/D8796

Files:
   include/shared_mutex
   
test/std/thread/thread.mutex/thread.mutex.requirements/thread.sharedtimedmutex.requirements/thread.sharedtimedmutex.class/stl_bug.pass.cpp
Because the initialism for Stefan's name and that of the Standard Template Library are the same, I'd rather see this named something reflecting what the bug was, instead of the initials of the guy who reported it. This avoids the confused question of "isn't every libc++ bug an STL bug?", despite him having made a big name for himself in the community.

In either case, putting a reference to his name in the comments would probably be useful. Also, did he file a PR for this?


Cheers,

Jon

EMAIL PREFERENCES
   http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


--
Jon Roelofs
[email protected]
CodeSourcery / Mentor Embedded
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to