How do I sleep in Ghc?

Lyle Kopnicky kopnicky at cse.ogi.edu
Mon Dec 8 18:20:47 EST 2003


Here's a POSIX implementation of a sleep function in C, as found in the 
book "Advanced Programming in the UNIX Environment":

    http://www.yendor.com/programming/unix/apue/lib.svr4/sleep.c

AFAIK, all the GHC platforms, including Windows, are POSIX compliant.  
You could compile this code separately and call it via the FFI.  If it 
doesn't work on Windows, you could instead call:

Win32::Sleep(TIME) 

    [CORE] Pauses for TIME milliseconds. The timeslices are made
    available to other processes and threads.

Hope that helps,
Lyle Kopnicky

BTW, you have a very interesting disclaimer in your message.  I hope I 
will not go to jail for reading it.



Ben_Yu at asc.aon.com wrote:

>Hi there,
>
>In Ghc, how do I sleep for say, 1 minute? I'm trying to write a simple file
>arrival listener and could not find the sleep api. Can haskell do it at
>all?
>
>Thanks.
>
>Ben.
>
>
>This message is intended only for the addressee and may contain information
>that is confidential or privileged. Unauthorized use is strictly prohibited
>and may be unlawful. If you are not the intended recipient, or the person
>responsible for delivering to the intended recipient, you should not read,
>copy, disclose or otherwise use this message, except for the purpose of
>delivery to the addressee. If you have received this email in error, please
>delete and advise us immediately.
>
>
>_______________________________________________
>Haskell mailing list
>Haskell at haskell.org
>http://www.haskell.org/mailman/listinfo/haskell
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://haskell.org/pipermail/haskell/attachments/20031208/cc472c72/attachment.htm


More information about the Haskell mailing list