From f4e5bc206ef59855b4a9065a443de3fc87d832e9 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 23 Oct 2014 12:58:16 -0700 Subject: [PATCH] reactor: oneshot timer should remove self from reactor Fixes #84 --- src/common/libflux/handle.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/libflux/handle.c b/src/common/libflux/handle.c index 0476adcd37a0..11531ea2746d 100644 --- a/src/common/libflux/handle.c +++ b/src/common/libflux/handle.c @@ -250,6 +250,7 @@ typedef struct { } zs; struct { int timer_id; + bool oneshot; FluxTmoutHandler fn; void *arg; } tmout; @@ -388,6 +389,8 @@ int flux_handle_event_tmout (flux_t h, int timer_id) } d = zlist_next (h->reactor->dsp); } + if (d && d->tmout.oneshot) + flux_tmouthandler_remove (h, d->tmout.timer_id); return rc; } @@ -549,6 +552,7 @@ int flux_tmouthandler_add (flux_t h, unsigned long msec, bool oneshot, d->tmout.fn = cb; d->tmout.arg = arg; d->tmout.timer_id = id; + d->tmout.oneshot = oneshot; if (zlist_append (h->reactor->dsp, d) < 0) oom (); return id;