/* ----------------------------------------------------------------------------- L2TP Timer, at 500 ms. Replaces l2tp_slowtimo, which is deprecated. ----------------------------------------------------------------------------- */ static uint8_t l2tp_timer_thread_is_dying = 0; /* > 0 if dying */ static uint8_t l2tp_timer_thread_is_dead = 0; /* > 0 if dead */ static void l2tp_timer() { struct timespec ts = {0}; /* timeout of 500 ms */ ts.tv_nsec = 500 * 1000 * 1000; ts.tv_sec = 0; lck_mtx_lock(ppp_domain_mutex); while (TRUE) { if (l2tp_timer_thread_is_dying > 0) { break; } l2tp_rfc_slowtimer(); msleep(&l2tp_timer_thread_is_dying, ppp_domain_mutex, PSOCK, "l2tp_timer_sleep", &ts); } l2tp_timer_thread_is_dead++; wakeup(&l2tp_timer_thread_is_dead); lck_mtx_unlock(ppp_domain_mutex); thread_terminate(current_thread()); }
/* ----------------------------------------------------------------------------- slow timer function, called every 500ms ----------------------------------------------------------------------------- */ void l2tp_slowtimo() { lck_mtx_lock(ppp_domain_mutex); l2tp_rfc_slowtimer(); lck_mtx_unlock(ppp_domain_mutex); }