summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-01-27 02:45:34 -0500
committerjoe <joe@jerkface.net>2014-01-27 02:45:34 -0500
commit716dffcc5f0c21d39c08e512f0dd51950d1bc482 (patch)
tree5319359e36b19dad0edbd3a7d3e2a70ca4cb2d96
parent11cfdea302aecc73485c1e86ccf41eea3bc07257 (diff)
wait on TMVar instead of using getLine
-rw-r--r--Presence/main.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/Presence/main.hs b/Presence/main.hs
index 9d359292..db1a7445 100644
--- a/Presence/main.hs
+++ b/Presence/main.hs
@@ -801,7 +801,7 @@ start ip4or6 = do
801 remotes <- forkIO $ seekRemotePeers (PeerSessions global_state) chan (remotePeers global_state) 801 remotes <- forkIO $ seekRemotePeers (PeerSessions global_state) chan (remotePeers global_state)
802 802
803 installHandler sigUSR1 (Catch (dologin (userError "signaled"))) Nothing 803 installHandler sigUSR1 (Catch (dologin (userError "signaled"))) Nothing
804 -- installHandler sigTERM (CatchOnce (dologin (userError "term signaled"))) Nothing 804
805 mtty <- monitorTTY (on_chvt global_state) 805 mtty <- monitorTTY (on_chvt global_state)
806 inotify <- initINotify 806 inotify <- initINotify
807#ifndef NOUTMP 807#ifndef NOUTMP
@@ -816,8 +816,12 @@ start ip4or6 = do
816 816
817 threadDelay 1000 -- wait a moment to obtain current tty 817 threadDelay 1000 -- wait a moment to obtain current tty
818 dologin () 818 dologin ()
819 L.putStrLn "\nHit enter to terminate...\n" 819 -- L.putStrLn "\nHit enter to terminate...\n"
820 getLine 820 quitVar <- newEmptyTMVarIO
821 installHandler sigTERM (CatchOnce (atomically $ putTMVar quitVar True)) Nothing
822 quitMessage <- atomically $ takeTMVar quitVar
823 -- getLine
824
821 killThread remotes 825 killThread remotes
822 quitListening clients 826 quitListening clients
823 quitListening peers 827 quitListening peers