[PATCH] tevent and threads - infrastructure improvements.

Jeremy Allison jra at samba.org
Wed Jul 22 23:21:55 UTC 2015


On Wed, Jul 22, 2015 at 04:12:08PM -0700, Jeremy Allison wrote:
> On Thu, Jul 23, 2015 at 12:52:15AM +0200, Stefan (metze) Metzmacher wrote:
> 
> > Something like this would be better:
> > 
> > struct tevent_context *tevent_thread_proxy_context(struct tevent_context
> > *main_ev);
> > 
> > The thread can then only schedule immediate events on the returned proxy
> > context, this will wakeup the main_ev and move the immediate events from
> > the proxy to the main_ev.
> > 
> > The immediate events can be preallocated in before starting the thread.
> 
> I don't get this. Can you explain how this would be
> used in the same way as ev_async_send() ?

More thing I don't get. Who calls tevent_thread_proxy_context() ?
Is it the requesting thread ? If you're returning a struct tevent_context *
that means internal changes to tevent_immediate when you schedule
to decide if it's a regular context or a "proxy" context. As I've
said, preallocation is a non-starter for scalable use so I think
I need to see sample client code before I can understand your
thinking here.

Also the code I posted has no internal changes to existing
tevent code, which is a big plus for me.



More information about the samba-technical mailing list