summaryrefslogtreecommitdiff
path: root/lib/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/event.c')
-rw-r--r--lib/event.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/event.c b/lib/event.c
index a8eb89f48d..b971bd70e6 100644
--- a/lib/event.c
+++ b/lib/event.c
@@ -1491,9 +1491,9 @@ void event_cancel(struct event **thread)
cr->thread = *thread;
listnode_add(master->cancel_req, cr);
do_event_cancel(master);
- }
- *thread = NULL;
+ *thread = NULL;
+ }
}
/**
@@ -2066,10 +2066,15 @@ void event_call(struct event *thread)
/* Execute thread */
void _event_execute(const struct xref_eventsched *xref, struct event_loop *m,
- void (*func)(struct event *), void *arg, int val)
+ void (*func)(struct event *), void *arg, int val,
+ struct event **eref)
{
struct event *thread;
+ /* Cancel existing scheduled task TODO -- nice to do in 1 lock cycle */
+ if (eref)
+ event_cancel(eref);
+
/* Get or allocate new thread to execute. */
frr_with_mutex (&m->mtx) {
thread = thread_get(m, EVENT_EVENT, func, arg, xref);