tevent immediate events

simo idra at samba.org
Fri Mar 13 12:15:52 GMT 2009


On Fri, 2009-03-13 at 12:40 +0100, Stefan (metze) Metzmacher wrote:
> Hi,
> 
> We have some usecases for directly triggered timed events
> where we can't do proper reporting of allocation errors.
> 
> I'd like to propose to add new event class for immediately triggered
> events:
> 
> typedef void (*tevent_immediate_handler_t)(struct tevent_context *ctx,
>                                            struct tevent_immediate *im,
>                                            void *private_data);
> struct tevent_immediate *tevent_allocate_immediate(TALLOC_CTX *mem_ctx);
> void tevent_schedule_immediate(struct tevent_context *ctx,
>                                struct tevent_immediate *im,
>                                tevent_immediate_handler_t handler,
>                                void *private_data);
> 
> The caller allocated the tevent_immediate structure once and can
> then schedule() it when needed. Once the event is triggered it's
> detached from the tevent_context again. The caller can reuse it later.
> 
> if the schedule function is called while the event was still scheduled,
> it will be detached from the old tevent_context and attached to the new
> context.

Can you please clarify better what problem are you trying to solve with
this scheme?
Maybe give an example that shows why tevent_add_timer does not work and
how this solves the problem.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-technical mailing list