[PATCH] talloc with threads tutorial and tests

Jeremy Allison jra at samba.org
Mon Mar 16 13:46:58 MDT 2015


On Mon, Mar 16, 2015 at 03:36:11PM -0400, Simo wrote:
> On Mon, 2015-03-16 at 12:28 -0700, Jeremy Allison wrote:
> > So one of the things that came up at the Vault
> > conference in conversations with Jeff was the
> > real lack of a guide on how to use talloc in
> > pthreaded code.
> > 
> > Here is an attempt to fix that, plus a test
> > case added to smbtorture local.talloc to ensure
> > talloc works correctly in a threaded environment.
> > 
> > Please review and comment/push !
> > 
> > Thanks,
> > 
> > 	Jeremy.
> 
> +10!
> 
> Very nice to see this.
> 
> Aside:
> Jeremy would you like a method of passing a context that avoids shared
> variables and mutexes and uses instead a pipe for synchronization ?
> I think it's be neat and simpler to use, perhaps even more performant as
> you do not get many threads contending on a single variable, but with
> the downside of requiring a pipe between main thread and each sub
> thread.

Maybe as a second example. I really want to keep a simple,
threads-only solution as the first example so people don't
have to think about all the issues you get with pipes
(sync/async send, signal handling, partial writes etc.
etc. etc.).

I'm sure it would perform better, but this is about
correctness initially, not performance.

Other than that, is this a 'Reviewed-by:' ? :-).

Cheers,

	Jeremy.


More information about the samba-technical mailing list