
On Tue, 2009-02-10 at 09:57 -0800, Corey O'Connor wrote:
The POSIX sleep function is defined as: sleep() makes the current process sleep until seconds seconds have elapsed or a signal arrives which is not ignored.
Sounds like a signal is arriving that is interrupting the sleep.
-Corey O'Connor
I tested this when testing the original code; sleep reports that the signal received is 5 (SIGTRAP). However, the following code does not work:
import System.Posix
main = do putStrLn "Waiting for 5 seconds." print sigTRAP blockSignals $ addSignal sigTRAP emptySignalSet signal <- sleep 5 print signal putStrLn "Done."
This, on the other (strange) hand, does:
import System.Posix
main = do putStrLn "Waiting for 5 seconds." blockSignals fullSignalSet signal <- sleep 5 print signal putStrLn "Done."
- George