我正在尝试制作一个简单的计时器,它会在时间到来时触发特定的回调。我写了这段代码:
void testTimer()
{
pj_timer_heap_t *timer_heap;
pj_timer_entry registrationTimer;
char *username="test_data";
pj_timer_entry_init(®istrationTimer, 50, username, &on_timer_event);
pj_time_val delay;
delay.sec = 5;
delay.msec = 0;
pj_status_t status = pj_timer_heap_create(global.pool, 256, &timer_heap);
status=pj_timer_heap_schedule(timer_heap,®istrationTimer, &delay);
}
我不知道代码有什么问题。此代码崩溃pj_timer_heap_schedule
。我无法弄清楚缺少什么。请帮忙。