[linux-audio-dev] timesetevent alternative
Lee Revell
rlrevell at joe-job.com
Fri May 6 18:17:02 UTC 2005
On Fri, 2005-05-06 at 14:30 +0200, Benno Senoner wrote:
> Paul Davis wrote:
>
> >usleep (2) is the canonical high resolution sleep function on POSIX
> >(although nanosleep(2) is a close cousin). the resolution is limited
> >by the system timer interrupt frequency, which is typically either
> >100Hz (2.4 and older kernels) or 1kHz (2.6 kernels)
> >
> >
> Right,
> nanosleep() might be a bit more precise than usleep() but for low sleep
> values ( AFAIK < 2msec ) it
> busywaits when you run your app SCHED_FIFO which in the case of
> sustained streams of low sleep values
> could chew up all the CPU, not idea for real time audio apps.
>
Not anymore. From man 2 nanosleep:
Old behaviour
In order to support applications requiring much more precise
pauses (e.g., in order to control some time-critical hardware),
nanosleep would handle pauses of up
to 2 ms by busy waiting with microsecond precision when called
from a process scheduled under a real-time policy like SCHED_FIFO or
SCHED_RR. This special
extension was removed in kernel 2.5.39, hence is still present in
current 2.4 kernels, but not in 2.6 kernels.
Lee
More information about the Linux-audio-dev
mailing list