[PATCH] tevent and threads - infrastructure improvements.
Jeremy Allison
jra at samba.org
Thu Jul 23 20:55:33 UTC 2015
On Thu, Jul 23, 2015 at 10:43:46AM +0200, Stefan (metze) Metzmacher wrote:
>
> True, maybe something like
>
> struct tevent_thread_proxy *tevent_thread_proxy_create(struct
> tevent_context *main_ev);
That works - means more granular locks which is probably a
good thing.
> void tevent_thread_proxy_schedule(struct tevent_thread_proxy *proxy,
> struct tevent_immediate **im,
> tevent_immediate_handler_t handler,
> void *private_data);
Don't think that works. The caller of tevent_thread_proxy_schedule()
is the sending thread and should not get a handle back to the created
struct tevent_immediate * object.
Remember, this is fire-and-forget. Once you've called
tevent_thread_proxy_schedule() there's no way you can
guarentee to cancel the immediate request you've made
on the target thread - it may already have been
scheduled, run and your handle obsolete once
tevent_thread_proxy_schedule() returns.
changing this to:
void tevent_thread_proxy_schedule(struct tevent_thread_proxy *proxy,
tevent_immediate_handler_t handler,
void *private_data);
would work.
More information about the samba-technical
mailing list