[Lldb-commits] [PATCH][Review Request] Fix for potentially missed events in Core/Listener

Kaylor, Andrew andrew.kaylor at intel.com
Fri Oct 26 12:37:33 PDT 2012


This patch fixes a problem where the Listener class could get into a deadlocked state because it missed the arrival of a new event.  It was possible for a new event to arrive between the time Listener::WaitForEventsInternal checked the list of available events and the time it set the conditional variable indicating that the event it was waiting for was not available.  The patch closes this loophole by locking the m_events_mutex before calling Listener::FindNextEventInternal and holding it until after it sets the condition variable.

In addition, I am removing the explicit Unlock in Listener::FindNextEventInternal because with the change above the calling function holds the mutex so it will not actually be unlocked.  The only potential problem I can see with this is if some implementation of Event::DoOnRemoval blocks waiting for an event to be received from another thread by the calling Listener object (which seems like a bad idea).

-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20121026/2c0a75a5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: listener-fix.patch
Type: application/octet-stream
Size: 1858 bytes
Desc: listener-fix.patch
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20121026/2c0a75a5/attachment.obj>


More information about the lldb-commits mailing list