TICKIT_TIMER_AFTER_MSEC(3)

NAME
tickit_timer_after_*, tickit_timer_cancel - invoke a callback after a fixed delay

SYNOPSIS
    #include <tickit.h>

    typedef int TickitCallbackFn(Tickit *t, TickitEventflags flags,
        void *user);

    int tickit_timer_after_msec(Tickit *t, int msec,
        TickitBindFlags flags, TickitCallbackFn *fn, void *user);
    int tickit_timer_after_tv(Tickit *t, const struct timeval *after,
        TickitBindFlags flags, TickitCallbackFn *fn, void *user);

    void tickit_timer_cancel(Tickit *t, int id);

Link with -ltickit.

DESCRIPTION
The tickit_timer_after_*() family of functions register a callback function to be invoked by the toplevel event loop a fixed delay afterwards. A registered callback will be invoked by a running call to tickit_run(3). The callback function will be invoked once, and then destroyed afterwards. Each function returns an opaque integer value which serves to identify this instance.

When invoked, the callback function is always passed both TICKIT_EV_FIRE and TICKIT_EV_UNBIND flags to its flags argument. If the callback had been registered with the TICKIT_BIND_DESTROY flag, then it will also be invoked with the TICKIT_EV_DESTROY flag if it has not yet been invoked by the time the toplevel instance is destroyed.

tickit_timer_cancel() removes a timer callback previously registered, by the identifier returned when it was added. If it had been added with the TICKIT_BIND_UNBIND flag then it will be invoked with the TICKIT_EV_UNBIND as it is removed.

RETURN VALUE
tickit_timer_after_msec() and tickit_timer_after_tv() return an identifier integer. tickit_timer_cancel() returns no value.

SEE ALSO
tickit_new_stdio(3), tickit_later(3), tickit(7)