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

Kaylor, Andrew andrew.kaylor at intel.com
Mon Nov 12 14:20:29 PST 2012


Ping (with refreshed patch)

From: lldb-commits-bounces at cs.uiuc.edu [mailto:lldb-commits-bounces at cs.uiuc.edu] On Behalf Of Kaylor, Andrew
Sent: Friday, October 26, 2012 12:38 PM
To: lldb-commits at cs.uiuc.edu
Subject: [Lldb-commits] [PATCH][Review Request] Fix for potentially missed events in Core/Listener

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/20121112/33585775/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/20121112/33585775/attachment.obj>


More information about the lldb-commits mailing list