[Haskell-cafe] Wait forever in main thread
Don Stewart
dons at galois.com
Mon May 17 13:12:34 EDT 2010
dpx.infinity:
> 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?
Block on an MVar that will be set by the child thread when it
terminates?
main = do
done <- newEmptyMVar
forkIO $ do ... child code ...
putMVar done ()
takeMVar done
print "Child is done"
More information about the Haskell-Cafe
mailing list