[LTP] [PATCH 2/2] syscalls/timer_settime01: Make sure the timer fires

Viresh Kumar viresh.kumar@linaro.org
Tue Jun 30 04:27:57 CEST 2020


On 29-06-20, 14:13, Cyril Hrubis wrote:
> Hi!
> > > This works well for all clocks except CLOCK_PROCESS_CPUTIME_ID and
> > > CLOCK_THREAD_CPUTIME_ID for some reason. I tried to read the values for
> > > those clocks by sleeping for 1 second and then reading values using
> > > timer_gettime() in a loop, and the value incremented every 15-16 seconds
> > > by a value of 1 (which was in ms if I am not wrong).
> > >
> > > No idea what the hell is going on here and so need experts advice :)
> > 
> > The problem is that these clocks only tick while the process is running. Instead
> > of sleeping for one second, you need to be in a busy-loop to ensure they
> > actually advance.
> 
> Indeed, we may as well do something as:
> 
> 	while (!caught_signal);
> 
> instead of sleep() in the case of the CPUTIME clocks.

So I did the right thing by asking and not wasting time :)

-- 
viresh


More information about the ltp mailing list