aboutsummaryrefslogtreecommitdiff
path: root/Assistant.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-25 16:51:01 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-25 16:51:01 -0400
commitbe9f7bcae56083e83a31509e023dd562b3ec213c (patch)
tree657e4dbd109d96803e1ec10229f86f6b793c4327 /Assistant.hs
parentd0268981b5411edf812bef00b8d08801e0e75fe9 (diff)
better bound thread
Diffstat (limited to 'Assistant.hs')
-rw-r--r--Assistant.hs16
1 files changed, 7 insertions, 9 deletions
diff --git a/Assistant.hs b/Assistant.hs
index 77790b9c6..0fdda6997 100644
--- a/Assistant.hs
+++ b/Assistant.hs
@@ -216,19 +216,17 @@ startAssistant assistant daemonize webappwaiter = withThreadState $ \st -> do
, assist $ transferScannerThread st dstatus scanremotes transferqueue
, assist $ configMonitorThread st dstatus branchhandle commitchan
#ifdef WITH_XMPP
- , assist $ pushNotifierThread st dstatus pushnotifier
+ {- Bound thread, because TLS needs it. -}
+ , bound $ assist $ pushNotifierThread st dstatus pushnotifier
#endif
, watch $ watchThread st dstatus transferqueue changechan
]
waitForTermination
- watch a = (True, a)
- assist a = (False, a)
- {- Each named thread is started in a bound thread.
- - (forkOS rather than forkIO). There are not too many,
- - and this deals with libraries like gnuTLS that
- - require only one thread access them. -}
- startthread dstatus (watcher, t)
- | watcher || assistant = void $ forkOS $
+ watch a = (forkIO, True, a)
+ assist a = (forkIO, False, a)
+ bound (_, watcher, t) = (forkOS, watcher, t)
+ startthread dstatus (runner, watcher, t)
+ | watcher || assistant = void $ runner $
runNamedThread dstatus t
| otherwise = noop