gtpc2m6x | C/C++ Language Support User's Guide |
This function causes the calling process to be suspended until the specified amount of real time has elapsed or a signal is caught by the process and the signal handler returns.
Format
#include <unistd.h> unsigned int sleep(unsigned int seconds);
Normal Return
The sleep function is always successful.
If the sleep function returns because of the receipt of a signal, the return value is the number of seconds remaining. Otherwise, 0 is returned.
Error Return
Not applicable.
Programming Considerations
Examples
The following example waits for an incoming signal or waits up to 10 seconds.
#include <unistd.h>
·
·
·
/* Wait for an incoming signal or up to 10 seconds */ sleep (10);
·
·
·
Related Information