athierry-oct wrote:

I've just pushed a new version that moves the pending events from the previous 
listener to the hijack listener when hijacking, and vice-versa when restoring 
the previous listener.

In the patch:

- Transferring the events between listeners is done atomically with 
adding/removing the hijack listener (by holding `m_listeners_mutex`), It should 
not be possible for an event to be received in the previous listener after the 
transfer of events but before the switch of listeners, because 
`m_listeners_mutex` is also locked by `PrivateBroadcastEvent()`
- In `HijackBroadcaster()` and `RestoreBroadcaster()`, we're holding both 
`m_listeners_mutex` and the listeners' `m_events_mutex`. So in theory, a 
deadlock is possible if some other thread locks `m_events_mutex` and then 
`m_listeners_mutex`. I've not seen any place in the code where that happens, 
but please let me know if I missed something.

https://github.com/llvm/llvm-project/pull/144919
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to