[Lldb-commits] [PATCH] D38938: Logging: provide a way to safely disable logging in a forked process

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Sun Oct 15 15:14:51 PDT 2017

On 15 October 2017 at 23:04, Zachary Turner <zturner at google.com> wrote:
> Doesn’t DisableAllLogChannels acquire a scoped lock? If so wouldn’t it just
> release at the end of the function?

The thing is, it is unable to acquire the lock in the first place,
because the mutex is already "locked". So, the sequence of events is
process 1, thread 1: acquire lock
process 1, thread 2: fork(), process 2 is created
process 1 thread 1: release lock
everything goes well from now on in process 1...
process 2, thread one (and only). acquire lock:
Process 2 is deadlocked because there is noone to release the lock there.

More information about the lldb-commits mailing list