FreeBSD/sys/kern/kern_tc.c
/*
 * Access to current ffcounter value.
 */
Access to current ffcounter value.
Access to current ffcounter value .
void
ffclock_read_counter(ffcounter *ffcount)
{
	struct timehands *th;
	struct fftimehands *ffth;
	unsigned int gen, delta;
	do {
		th = timehands;
		gen = atomic_load_acq_int(&th->th_generation);
		ffth = fftimehands;
		delta = tc_delta(th);
		*ffcount = ffth->tick_ffcount;
		atomic_thread_fence_acq();
	} while (gen == 0 || gen != th->th_generation);
	*ffcount += delta;
}
void ffclock_read_counter ( ffcounter * ffcount ) { struct timehands * th ; struct fftimehands * ffth ; unsigned int gen , delta ; do { th = timehands ; gen = atomic_load_acq_int ( & th -> th_generation ) ; ffth = fftimehands ; delta = tc_delta ( th ) ; * ffcount = ffth -> tick_ffcount ; atomic_thread_fence_acq ( ) ; } while ( gen == 0 || gen != th -> th_generation ) ; * ffcount += delta ; }
Access to current ffcounter value.
Access to current ffcounter value .
/*
	 * ffclock_windup() called from tc_windup(), safe to rely on
	 * th->th_generation only, for correct delta and ffcounter.
	 */