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 $ addSign
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 em
Corey O'Connor ha scritto:
2009/2/10 George Pollard :
import System.Posix
main = do
putStrLn "Waiting for 5 seconds."
blockSignals $ addSignal sigVTALRM emptySignalSet
sleep 5
putStrLn "Done."
Huh! Does the GHC runtime uses this signal? Perhaps for scheduling?
Righ
Also attached is a diff for strace between non-threaded and threaded.
execve("./sleep", ["./sleep"], [/* 38 vars */]) = 0
execve("./sleep", ["./sleep"], [/* 38 vars */]) = 0
brk(0) = 0x83c2000 | brk(0)
= 0x8f
2009/2/10 George Pollard :
>> import System.Posix
>>
>> main = do
>> putStrLn "Waiting for 5 seconds."
>> blockSignals $ addSignal sigVTALRM emptySignalSet
>> sleep 5
>> putStrLn "Done."
>>
Huh! Does the GHC runtime uses this signal? Perhaps for scheduling?
Cheers,
-Corey
On Wed, 2009-02-11 at 00:05 +0100, Manlio Perillo wrote:
> John Ky ha scritto:
> > Hi Haskell Cafe,
> >
> > I wrote very short program to sleep for 5 seconds compiled with the
> > -threaded option in ghc on the Mac OS X 1.5.
> >
> > I am finding that using the sleep function doesn't sleep at all
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.
>
>
John Ky ha scritto:
Hi Haskell Cafe,
I wrote very short program to sleep for 5 seconds compiled with the
-threaded option in ghc on the Mac OS X 1.5.
I am finding that using the sleep function doesn't sleep at all, whereas
using threadDelay does:
[...]
main = do
putStrLn "Waiting for
Not to say the issue shouldn't be tracked down, but shouldn't a more
portable function be used anyway?
untested example:
maxBoundMicroSecInSec =(maxBound `div` 10^6)
threadDelaySec :: Int -> IO ()
threadDelaySec s
| s > maxBoundMicroSecInSec = threadDelay (maxBoundMicroSecInSec *
10^6) >> thr
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
2009/2/9 John Ky :
> Hi Peter,
>
> Source code:
> im
I can confirm this behaviour, on:
Linux 2.6.27-11-generic #1 SMP i686 GNU/Linux
Difference in the RTS between non-working and working:
("RTS way", "rts_thr")
("RTS way", "rts")
- George
signature.asc
Description: This is a digitally signed message part
_
Hi Peter,
Source code:
import System.IO
import System.Posix
main = do
putStrLn "Waiting for 5 seconds."
sleep 5 -- doesn't sleep at all
putStrLn "Done."
OS:
Mac OS X 10.5
Compile command:
ghc --threaded testsleep.hs
If I remove --threaded, then it does sleep.
Thanks,
-John
Hi John,
Which sleep are you using? From which module? Can you show the full source
with import statements?
Cheers,
Peter
2009/2/9 John Ky
> Hi Haskell Cafe,
>
> I wrote very short program to sleep for 5 seconds compiled with the
> -threaded option in ghc on the Mac OS X 1.5.
>
> I am finding t
Hello John,
Tuesday, February 10, 2009, 12:35:25 AM, you wrote:
> I am finding that using the sleep function doesn't sleep at all, whereas
> using threadDelay does:
> Anybody know what's happening?
1) this depends on your sleep definition
2) read threadDelay docs
--
Best regards,
Bulat
Hi Haskell Cafe,
I wrote very short program to sleep for 5 seconds compiled with the
-threaded option in ghc on the Mac OS X 1.5.
I am finding that using the sleep function doesn't sleep at all, whereas
using threadDelay does:
main = do
putStrLn "Waiting for 5 seconds."
threadDelay 5
15 matches
Mail list logo