Can someone explain to me why the following code does not sleep 5 seconds?
I have a hunch that a signal from the forked child invalidates the sleep - but I have no proof.
This is a known UNIX phenomenon. SIGCHLD interrupts sleep(). The workaround is:
don't let the thread return, but let it sleep itself until killed by the process forking it.