Mailing List archive

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

[vdr] Re: Avoiding NPTL problems



Ludwig Nussel <ludwig.nussel@gmx.de> wrote:

> With regard to removing the usleeps, that's necessary as far as I
> can tell since the manpage of nanosleep (usleep is wrapper for
> nanosleep) says
> 
> 'If the process is scheduled under a real-time policy like
> SCHED_FIFO or SCHED_RR, then pauses of up to 2 ms will be performed
> as busy waits with microsecond precision.'
> 
> According to this the scheduler would not switch to another thread
> during the usleep which would explain why it causes hangs.
> 
> There are other usleeps in recorder.c and transfer.c and
> coincidentally recording also has problems with NPTL.

if the reason for the usleep()s is to force or at least allow a context
switch to happen, wouldn't it be much better to use sched_yield() ?

i would consider the (ab)use of usleep for this purpose a bug anyway.
;-)

see the man page for details.

best regards ...
clemens




Home | Main Index | Thread Index