Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: usleep question.



Andreas Schultz wrote:
...
> so, we are using nanosleep ;-)

Good. 
Does that mean the suggestion in the man page is obsolete?


> The selection of 1ms is arbritraty and could probably also replace by
> sched_yield(). 

usleep(1) does not request 1 ms, but 1/1000 ms!
1ms would be usleep(1000).


> asmlinkage long sys_nanosleep(struct timespec *rqtp, struct timespec *rmtp)
> {
>     .....
>                 /*
>                  * Short delay requests up to 2 ms will be handled with
>                  * high precision by a busy wait for all real-time processes.
>                  *
> 
> This explains the lookup's when running under real-time scheduling. The
> scheduler will not allow other process to run, therefore completly blocking
> out all other processes.

That also suggests that it would be safer to use 
usleep(10000) instead of usleep(1), doesn't it?

Carsten.



Home | Main Index | Thread Index