Yes, even sleeping requires sufficient knowledge to perform correctly! Often, your process has to enter a sleep state. We have all probably learned to use the sleep(3) API to do so:
#include <unistd.h>unsigned int sleep(unsigned int seconds);
As a simple example, let's say that the process must work this way (pseudo code follows):
It's quite clear: the process must sleep for 10 seconds; the code shown should work. Is there a problem?
Well, yes, signals: what if the process enters the sleep, but three seconds into the sleep a signal arrives? The default behavior (meaning, unless signals are masked) is to handle the signal, and you would imagine, go back to sleep for the remaining time ...