summaryrefslogtreecommitdiff
path: root/lifted-concurrent/src/Control/Concurrent/ThreadUtil.hs
blob: a258d9339e4f2630f5dbc9c42c646ee4516301b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{-# LANGUAGE CPP #-}
module Control.Concurrent.ThreadUtil
    (
#ifdef THREAD_DEBUG
      module Control.Concurrent.Lifted.Instrument
#else
      module Control.Control.Lifted
    , module GHC.Conc
#endif
    ) where

#ifdef THREAD_DEBUG
import Control.Concurrent.Lifted.Instrument
#else
import Control.Concurrent.Lifted
import GHC.Conc                  (labelThread)

forkLabeled :: String -> IO () -> IO ThreadId
forkLabeled lbl action = do
    t <- forkIO action
    labelThread t lbl
    return t
{-# INLINE forkLabeled #-}

forkOSLabeled :: String -> IO () -> IO ThreadId
forkOSLabeled lbl action = do
    t <- forkOS action
    labelThread t lbl
    return t
{-# INLINE forkOSLabeled #-}
#endif