Mir

Code review comment for lp:~albaguirre/mir/fix-1421255

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

A simpler and guaranteed more reliable solution would be to move away from a pure callback approach (which we use in many places)...

Instead, if we replaced such logic:
   call callback(args)
with:
   signal event(args)
then there is zero risk of deadlocks.

Receivers could then wait for an event, multiple events, or even join a thread pool that turns events into callbacks if they want to work that way. But the important point is even in the callback case then, the thread making the callback has no risk of causing deadlocks. Because it's dedicated just to making unlocked callbacks and nothing else. But of course, it's more efficient to not need additional threads too.

« Back to merge proposal