diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2014-09-18 18:55:44 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2014-09-18 18:55:44 +0000 |
commit | 3534b428629be185e096be99e3bd5fdfe32d5544 (patch) | |
tree | 210ef3198ed66bc7f7b7bf6a85e4579f455e5a36 /src/libunixonacid/unixmessage_timed_handle.c | |
download | skalibs-3534b428629be185e096be99e3bd5fdfe32d5544.tar.xz |
initial commit with rc for skalibs-2.0.0.0
Diffstat (limited to 'src/libunixonacid/unixmessage_timed_handle.c')
-rw-r--r-- | src/libunixonacid/unixmessage_timed_handle.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/libunixonacid/unixmessage_timed_handle.c b/src/libunixonacid/unixmessage_timed_handle.c new file mode 100644 index 0000000..5ac7ccd --- /dev/null +++ b/src/libunixonacid/unixmessage_timed_handle.c @@ -0,0 +1,30 @@ +/* ISC license. */ + +#include <skalibs/functypes.h> +#include <skalibs/tai.h> +#include <skalibs/unix-timed.h> +#include <skalibs/unixmessage.h> + +typedef struct unixmessage_handler_blah_s unixmessage_handler_blah_t, *unixmessage_handler_blah_t_ref ; +struct unixmessage_handler_blah_s +{ + unixmessage_receiver_t *b ; + unixmessage_handler_func_t *f ; + void *p ; +} ; + +static int getfd (unixmessage_handler_blah_t *blah) +{ + return unixmessage_receiver_fd(blah->b) ; +} + +static int get (unixmessage_handler_blah_t *blah) +{ + return unixmessage_handle(blah->b, blah->f, blah->p) ; +} + +int unixmessage_timed_handle (unixmessage_receiver_t *b, unixmessage_handler_func_t *f, void *p, tain_t const *deadline, tain_t *stamp) +{ + unixmessage_handler_blah_t blah = { .b = b, .f = f, .p = p } ; + return timed_get(&blah, (initfunc_t_ref)&getfd, (initfunc_t_ref)&get, deadline, stamp) ; +} |