summaryrefslogtreecommitdiff
path: root/dht/src/Control/Concurrent/ThreadUtil.hs
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2019-10-18 09:43:20 +0000
committerJoe Crayne <joe@jerkface.net>2020-01-01 19:52:45 -0500
commit5bde2cfe951577be3018b437619cd0e87ab20096 (patch)
tree3077430f036d44d856caa3ca65e9f7644102fee5 /dht/src/Control/Concurrent/ThreadUtil.hs
parent88cb351cb6ddfb5e80f247bea6cc503ed1e12baf (diff)
Control.Concurrent.ThreadUtil replaces #ifdef imports
* new function, forkLabeled * new module Control.Concurrent.ThreadUtil * label a few unlabeled threads
Diffstat (limited to 'dht/src/Control/Concurrent/ThreadUtil.hs')
-rw-r--r--dht/src/Control/Concurrent/ThreadUtil.hs24
1 files changed, 24 insertions, 0 deletions
diff --git a/dht/src/Control/Concurrent/ThreadUtil.hs b/dht/src/Control/Concurrent/ThreadUtil.hs
new file mode 100644
index 00000000..2888e899
--- /dev/null
+++ b/dht/src/Control/Concurrent/ThreadUtil.hs
@@ -0,0 +1,24 @@
1{-# LANGUAGE CPP #-}
2module Control.Concurrent.ThreadUtil
3 (
4#ifdef THREAD_DEBUG
5 module Control.Concurrent.Lifted.Instrument
6#else
7 module Control.Control.Lifted
8 , module GHC.Conc
9#endif
10 ) where
11
12#ifdef THREAD_DEBUG
13import Control.Concurrent.Lifted.Instrument
14#else
15import Control.Concurrent.Lifted
16import GHC.Conc (labelThread)
17
18forkLabeled :: String -> IO () -> IO ThreadId
19forkLabeled lbl action = do
20 t <- forkIO action
21 labelThread t lbl
22 return t
23{-# INLINE forkLabeled #-}
24#endif