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;
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;
THREAD_OFF(wheel->timer);
XFREE(MTYPE_TIMER_WHEEL_LIST, wheel->wheel_slot_lists);
+ XFREE(MTYPE_TIMER_WHEEL, wheel->name);
XFREE(MTYPE_TIMER_WHEEL, wheel);
}
#define __WHEEL_H__
struct timer_wheel {
+ char *name;
struct thread_master *master;
int slots;
long long curr_slot;
*/
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);
/*
* Delete the specified timer wheel created
void pim_upstream_init(struct pim_instance *pim)
{
- char hash_name[64];
+ char name[64];
+ snprintf(name, 64, "PIM %s Timer Wheel",
+ pim->vrf->name);
pim->upstream_sg_wheel =
wheel_init(master, 31000, 100, pim_upstream_hash_key,
- pim_upstream_sg_running);
+ pim_upstream_sg_running, name);
- snprintf(hash_name, 64, "PIM %s Upstream Hash", pim->vrf->name);
+ snprintf(name, 64, "PIM %s Upstream Hash",
+ pim->vrf->name);
pim->upstream_hash = hash_create_size(8192, pim_upstream_hash_key,
- pim_upstream_equal, hash_name);
+ pim_upstream_equal, name);
pim->upstream_list = list_new();
pim->upstream_list->cmp = pim_upstream_compare;