void clock_delay_until( uint64_t deadline) { uint64_t now = mach_absolute_time(); if (now >= deadline) return; if ( (deadline - now) < (8 * sched_cswtime) || get_preemption_level() != 0 || ml_get_interrupts_enabled() == FALSE ) machine_delay_until(deadline); else { assert_wait_deadline((event_t)clock_delay_until, THREAD_UNINT, deadline - sched_cswtime); thread_block(THREAD_CONTINUE_NULL); } }
/* * Preserve the original precise interval that the client * requested for comparison to the spin threshold. */ void _clock_delay_until_deadline( uint64_t interval, uint64_t deadline) { if (interval == 0) return; if ( ml_delay_should_spin(interval) || get_preemption_level() != 0 || ml_get_interrupts_enabled() == FALSE ) { machine_delay_until(deadline); } else { assert_wait_deadline((event_t)clock_delay_until, THREAD_UNINT, deadline); thread_block(THREAD_CONTINUE_NULL); } }