In article <[EMAIL PROTECTED]>, Michael Beattie <[EMAIL PROTECTED]> wrote: >I am after a way to generate a pause of 300ns in a C program I am working >on.
In general, you cannot guarantee pauses in a multitasking system like Unix or Linux. Pauses can be set in microseconds using usleep(), but not in nanoseconds. And even then that is only the _minimum_ time that call will sleep - if the system decides to run another process at that point your program will only continue until the timeslice of the other process is over, 10 ms later .. >At the moment, I am using a for loop of about 700000 iterations.. >works okay, but on a faster system it will die.. (needed to slow down I/O >with an interface card) If you need to do timing that strict, and you're talking to hardware, you shouldn't do it from userspace but write a kernel module instead. Or you could use Linux-RT (Real Time), but the real time programs you have to create for Linux-RT are essentially kernel modules too .. Mike. -- "Did I ever tell you about the illusion of free will?" -- Sheriff Lucas Buck, ultimate BOFH.