summaryrefslogtreecommitdiff
path: root/src/common/evsched.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/evsched.c')
-rw-r--r--src/common/evsched.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/evsched.c b/src/common/evsched.c
index 1b290bb..a28db44 100644
--- a/src/common/evsched.c
+++ b/src/common/evsched.c
@@ -253,6 +253,12 @@ int evsched_schedule(evsched_t *s, event_t *ev, uint32_t dt)
/* Lock calendar. */
pthread_mutex_lock(&s->mx);
+ /* Make sure it's not already enqueued. */
+ int found = 0;
+ if ((found = heap_find(&s->heap, ev))) {
+ heap_delete(&s->heap, found);
+ }
+
heap_insert(&s->heap, ev);
/* Unlock calendar. */