Quantcast

Where threadSleep is defined?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Where threadSleep is defined?

dokondr
Hi,
I need to make the current process (executing thread) go to sleep for a given amount of time.  Can't find where threadSleep is defined.

Thanks!

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Where threadSleep is defined?

Felipe Almeida Lessa
It's threadDelay on Control.Concurrent [1].

Cheers,

[1] http://hackage.haskell.org/packages/archive/base/4.4.1.0/doc/html/Control-Concurrent.html#v:threadDelay

--
Felipe.

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Where threadSleep is defined?

paul r-2
In reply to this post by dokondr
dokondr> Hi, I need to make the current process (executing thread) go to
dokondr> sleep for a given amount of time.  Can't find where threadSleep
dokondr> is defined.

Maybe because there is no such threadSleep function in base packages,
what do you think ?

Ok, let's see if we can find what you are looking for ... You want
a function that will pause your thread for an amout of time then pass.
In other word, it would take an Int and do nothing else than wait as
a side effect, right ? Something typed "Int -> IO ()" should do that,
right ?

  http://www.haskell.org/hoogle/?hoogle=Int+-%3E+IO+%28%29

  => threadDelay :: Int -> IO ()
     Suspends the current thread for a given number of microseconds ...

And if you don't want to use the amazing power of hoogle, maybe you can
simply go to your favorite search engine and type "haskell pause thread"
in it. In mine, the first result is the doc of the Control.Concurrent
module that has a "Waiting" section (linked in the toc) that has ...
3 functions, amongst wich "threadDelay :: Int -> IO ()".

Wasn't hard, was it ?

--
  Paul

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Where threadSleep is defined?

dokondr
I was trying to google "haskell process sleep" without much success. It really needs some experience to construct hoogle queries correctly :)
Thanks everybody for your help!

On Tue, Dec 6, 2011 at 8:07 PM, Paul R <[hidden email]> wrote:
dokondr> Hi, I need to make the current process (executing thread) go to
dokondr> sleep for a given amount of time.  Can't find where threadSleep
dokondr> is defined.

Maybe because there is no such threadSleep function in base packages,
what do you think ?

Ok, let's see if we can find what you are looking for ... You want
a function that will pause your thread for an amout of time then pass.
In other word, it would take an Int and do nothing else than wait as
a side effect, right ? Something typed "Int -> IO ()" should do that,
right ?

 http://www.haskell.org/hoogle/?hoogle=Int+-%3E+IO+%28%29

 => threadDelay :: Int -> IO ()
    Suspends the current thread for a given number of microseconds ...

And if you don't want to use the amazing power of hoogle, maybe you can
simply go to your favorite search engine and type "haskell pause thread"
in it. In mine, the first result is the doc of the Control.Concurrent
module that has a "Waiting" section (linked in the toc) that has ...
3 functions, amongst wich "threadDelay :: Int -> IO ()".

Wasn't hard, was it ?

--
 Paul




_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Loading...