]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/wheel.c
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / wheel.c
index b1a3e89fc74ed440391c77c609900c2733b666cb..69d2fa48dc0b382d2875049139f99a5ec589c5cf 100644 (file)
@@ -29,7 +29,9 @@ DEFINE_MTYPE_STATIC(LIB, TIMER_WHEEL_LIST, "Timer Wheel Slot List")
 
 static int debug_timer_wheel = 0;
 
-static int wheel_timer_thread(struct thread *t)
+static int wheel_timer_thread(struct thread *t);
+
+static int wheel_timer_thread_helper(struct thread *t)
 {
        struct listnode *node, *nextnode;
        unsigned long long curr_slot;
@@ -65,15 +67,29 @@ static int wheel_timer_thread(struct thread *t)
        return 0;
 }
 
+static int wheel_timer_thread(struct thread *t)
+{
+       struct timer_wheel *wheel;
+
+       wheel = THREAD_ARG(t);
+
+       thread_execute_name(wheel->master, wheel_timer_thread_helper,
+                           wheel, 0, wheel->name);
+
+       return 0;
+}
+
 struct timer_wheel *wheel_init(struct thread_master *master, int period,
                               size_t slots, unsigned int (*slot_key)(void *),
-                              void (*slot_run)(void *))
+                              void (*slot_run)(void *),
+                              const char *run_name)
 {
        struct timer_wheel *wheel;
        size_t i;
 
        wheel = XCALLOC(MTYPE_TIMER_WHEEL, sizeof(struct timer_wheel));
 
+       wheel->name = XSTRDUP(MTYPE_TIMER_WHEEL, run_name);
        wheel->slot_key = slot_key;
        wheel->slot_run = slot_run;
 
@@ -99,11 +115,12 @@ void wheel_delete(struct timer_wheel *wheel)
        int i;
 
        for (i = 0; i < wheel->slots; i++) {
-               list_delete_and_null(&wheel->wheel_slot_lists[i]);
+               list_delete(&wheel->wheel_slot_lists[i]);
        }
 
        THREAD_OFF(wheel->timer);
        XFREE(MTYPE_TIMER_WHEEL_LIST, wheel->wheel_slot_lists);
+       XFREE(MTYPE_TIMER_WHEEL, wheel->name);
        XFREE(MTYPE_TIMER_WHEEL, wheel);
 }