[PATCH] tevent and threads - infrastructure improvements - version #2

Jeremy Allison jra at samba.org
Mon Sep 14 20:28:28 UTC 2015

On Mon, Sep 14, 2015 at 10:24:37PM +0200, Ralph Böhme wrote:
> > The reason the mutex must be held until after the signaling
> > is done is that in the second test code there may be a destructor
> > waiting to remove the proxy object once the mutex gets released,
> > and if that happens you get conflicting write errors.
> Hm. I don't see a pending desctructor in the second test that would
> fire before all threads have finished. Which talloc_free is triggering
> it? I'll give it a closer look tomorrow.

It's the talloc_free(ev) in the thread_fn_1() in the second
thread test added.

> So while I think you're probably right that we may need to lock the
> proxy object when we're still working on it, I'm wondering if there's
> something else fishy.

Yeah, I'm looking closely, but the patch I posted passes
--tool=helgrind and --tool=drd, when you release the mutex
before the write you get the problem I described.

More information about the samba-technical mailing list