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_receive.c | |
download | skalibs-3534b428629be185e096be99e3bd5fdfe32d5544.tar.xz |
initial commit with rc for skalibs-2.0.0.0
Diffstat (limited to 'src/libunixonacid/unixmessage_timed_receive.c')
-rw-r--r-- | src/libunixonacid/unixmessage_timed_receive.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/libunixonacid/unixmessage_timed_receive.c b/src/libunixonacid/unixmessage_timed_receive.c new file mode 100644 index 0000000..3761d26 --- /dev/null +++ b/src/libunixonacid/unixmessage_timed_receive.c @@ -0,0 +1,29 @@ +/* ISC license. */ + +#include <skalibs/functypes.h> +#include <skalibs/tai.h> +#include <skalibs/unix-timed.h> +#include <skalibs/unixmessage.h> + +typedef struct unixmessage_get_s unixmessage_get_t, *unixmessage_get_t_ref ; +struct unixmessage_get_s +{ + unixmessage_receiver_t *b ; + unixmessage_t *m ; +} ; + +static int getfd (unixmessage_get_t *g) +{ + return unixmessage_receiver_fd(g->b) ; +} + +static int get (unixmessage_get_t *g) +{ + return unixmessage_receive(g->b, g->m) ; +} + +int unixmessage_timed_receive (unixmessage_receiver_t *b, unixmessage_t *m, tain_t const *deadline, tain_t *stamp) +{ + unixmessage_get_t g = { .b = b, .m = m } ; + return timed_get(&g, (initfunc_t *)&getfd, (initfunc_t *)&get, deadline, stamp) ; +} |