On Sun, Oct 15, 2017 at 3:15 PM Pavel Labath <lab...@google.com> wrote:

> On 15 October 2017 at 23:04, Zachary Turner <ztur...@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
>

Suppose process 1 thread 1 had been executing this code:
```
lock();
logSomething();  // thread 2 forks when thread 1 is here.
unlock();
```

Doesn't thread 2 in the child process resume running from the same point?
If so, it seems that both the child and parent would both gracefully unlock
the lock.

I'm sure I'm wrong about this, but hopefully you can clarify what I'm
missing.

As a follow-up question, why can't we use execve instead of fork / exec?
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to