[PATCH] tevent and threads - infrastructure improvements.

Jeremy Allison jra at samba.org
Thu Jul 23 15:47:52 UTC 2015


On Thu, Jul 23, 2015 at 11:58:11AM +0300, Uri Simchoni wrote:
> So, passing around talloc'd objects between threads seems like a bad
> idea for overall multi-threaded app architecture, if talloc is not
> mt-safe.

talloc is mt-safe, so long as contexts are not shared between
threads without locking.

> The question that can be asked is - can tevent be used in a
> mt app, with talloc being just an implementation detail? The answer
> seems to be:
> 1. Yes, but it would loose some of tevent's appeal. For example one
> would have to use tevent_req_callback_data_void() instead of
> tevent_req_callback_data().
> 2. The new functionality is an exception - the pp_private has to be
> talloc'd. To be convenient, I'd want to pass my object from thread to
> thread, and not have to create a "pp_private wrapper". A fix for that
> can be to create the wrapping object (tallocated) inside
> tevent_threaded_async_call().

But every invocation has custom object needs. So IMHO
that wouldn't work.



More information about the samba-technical mailing list