On 21.12 01:13, Pupeno wrote:
> So, I install a signal handler with installHandler... and then ? how do I 
> prevent the program for quiting ? am I missing some kind of event loop here ?
> 

Here is a small server program:

main = performForkWithUnixySessionStuff work

-- this is just for testing, replace with real implementation
performForkWithUnixySessionStuff x = x

work = do s1 <- runStreamServer ...
          s2 <- runDgramServer ...
          mv <- newEmptyMVar
          installHandler someSignal (Catch (putMVar mv ())) Nothing
          takeMVar mv
          someCleanupActions
          killServer s1
          killServer s2

For simple testing you might want to just use getLine to wait for the right
time to exit.

- Einar Karttunen
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to