Re: nanosleep with C/iX (194 Views)
Occasional Visitor
Posts: 1
Registered: ‎01-08-2003
Message 1 of 2 (194 Views)

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 ?

Posts: 10
Registered: ‎02-05-2002
Message 2 of 2 (194 Views)

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.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.