better bound thread

This commit is contained in:
Joey Hess 2012-10-25 16:51:01 -04:00
parent 4aaa8665e1
commit c23c942c2c

View file

@ -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