[Haskell-cafe] Wait forever in main thread

Roel van Dijk vandijk.roel at gmail.com
Mon May 17 14:13:53 EDT 2010

Use our threads package [1].

import Control.Concurrent.Thread ( forkIO, wait_ )

myDBusThingie :: IO ()
myDBusThingie = error "TODO"

main :: IO ()
main = do tid <- forkIO myDBusThingie
          wait_ tid

But like David said, this is only usefull if you plan on multiple
concurrent waits or doing some other work during the wait. Otherwise
you can simply replace the contents of main with myDBusThingie.


1 - http://hackage.haskell.org/package/threads (new, backwards
compatible, version will be released soon)

On Mon, May 17, 2010 at 7:04 PM, DPX-Infinity <dpx.infinity at gmail.com> wrote:
> Hi,
> I'm writing a program which listens to some D-Bus signals using
> DBus.Client.onSignal function from dbus-client package. This function
> runs IO action in separate haskell thread when signal is received. My
> program does nothing except signal handling, so after setting up
> signals it has to wait indefinitely. Now I'm using not very clean (I
> think so) forever $ threadDelay 10000000 . Is there another (I mean,
> correct) method to do this thing?
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list