Skip to content

Commit

Permalink
reactor: oneshot timer should remove self from reactor
Browse files Browse the repository at this point in the history
  • Loading branch information
garlick authored and grondo committed Oct 31, 2014
1 parent 874a7be commit f4e5bc2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/libflux/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ typedef struct {
} zs;
struct {
int timer_id;
bool oneshot;
FluxTmoutHandler fn;
void *arg;
} tmout;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f4e5bc2

Please sign in to comment.