suspend a process for a given length of time
#include <unistd.h> unsigned int sleep( unsigned int seconds );
The sleep() function suspends the calling process until the number of real-time seconds specified by the seconds argument have elapsed, or a signal whose action is to either terminate the process or call a signal handler is received. The suspension time may be greater than the requested amount, due to the scheduling of other, higher priority activity by the system.
The sleep() function returns zero if the full time specified was completed; otherwise it returns the number of seconds unslept if interrupted by a signal.
If an error occurs, errno is set to indicate the type of error:
alarm(), delay(), errno, timer_create(), timer_gettime(), timer_settime()
/* * The following program sleeps for the * number of seconds specified in argv[1]. */ #include <stdlib.h> #include <unistd.h> void main( int argc, char **argv ) { unsigned seconds; seconds = (unsigned) strtol( argv[1], NULL, 0 ); sleep( seconds ); }
All (except DOS/PM)