Showing results for 
Search instead for 
Do you mean 

nanosleep with C/iX

Occasional Visitor

nanosleep with C/iX

I'm porting a C module that needs to sleep less than one second. usleep and nanosleep are not provided in the MPE C library. What would you suggest ?


Re: nanosleep with C/iX

I think that the easiest solution is to try calling the system intrinsic PAUSE. It is documented to PAUSE for multiples of seconds, but it does take a real number (IEEE on MPE/iX) and if you pass it a real number less than 1 second but greater than 1 heartbeat - 8192 microseconds/8 milliseconds - it should PAUSE that amount of time.
Or, another alternative is the select() socket call. The select call when you choose zero readmask, zero writemask, and pass it a timeout value of zero for timeout.tv_sec and some fractional value for timeout.tv_usec that should also cause the program to sleep for the desired period of time.
Hope that helps.