On Wed, 2009-02-11 at 01:50 +0100, Manlio Perillo wrote: > George Pollard ha scritto: > > [...] > > > >> So, it seems nanosleep get interruped by a signal. > > > > This works: > > > >> import System.Posix > >> > >> main = do > >> putStrLn "Waiting for 5 seconds." > >> blockSignals $ addSignal sigVTALRM emptySignalSet > >> sleep 5 > >> putStrLn "Done." > >> > > So (see my earlier email) `sleep` is lying about what interrupts it :) > > > > - George > > > A possibly better solution is: > > sleep' :: Int -> IO Int > sleep' n = do > n' <- sleep n > if n' == 0 then return 0 else sleep' n' > > > From the trace, I see that nanosleep is being called 17 times here. > > Another solution is to set RTS flag: > ./bug_sleep +RTS -V0 -RTS > > > What strange is that the timer is created in non threaded RTS, too, but > sleep is interrupted only with the threaded RTS. > > This may be caused by an "incorrect" execution of a foreign function > marked safe.
I just realized that for some reason I thought that `sleep` reported the signal that interrupted it... contrary to the documentation... as such, several of my replies to this thread may read as non-sequiturs :P
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
