diff options
author | James Crayne <jim.crayne@gmail.com> | 2019-10-18 09:01:03 +0000 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2020-01-01 19:50:02 -0500 |
commit | b3795514a956753b1b58a3709ce08e32d906b742 (patch) | |
tree | f554bafe905663e87250e084c36b5bc15f3f9dee /lifted-concurrent/src | |
parent | 9273a01aac621f09b0c00292b55153d558b4a4e0 (diff) |
forkLabeled
Diffstat (limited to 'lifted-concurrent/src')
-rw-r--r-- | lifted-concurrent/src/Control/Concurrent/Lifted/Instrument.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lifted-concurrent/src/Control/Concurrent/Lifted/Instrument.hs b/lifted-concurrent/src/Control/Concurrent/Lifted/Instrument.hs index fc3b6369..eeda4de8 100644 --- a/lifted-concurrent/src/Control/Concurrent/Lifted/Instrument.hs +++ b/lifted-concurrent/src/Control/Concurrent/Lifted/Instrument.hs | |||
@@ -1,6 +1,7 @@ | |||
1 | {-# LANGUAGE FlexibleContexts #-} | 1 | {-# LANGUAGE FlexibleContexts #-} |
2 | module Control.Concurrent.Lifted.Instrument | 2 | module Control.Concurrent.Lifted.Instrument |
3 | ( module Control.Concurrent.Lifted | 3 | ( module Control.Concurrent.Lifted |
4 | , forkLabeled | ||
4 | , forkIO | 5 | , forkIO |
5 | , forkOS | 6 | , forkOS |
6 | , fork | 7 | , fork |
@@ -42,6 +43,12 @@ globals = unsafePerformIO $ newMVar $ GlobalState | |||
42 | } | 43 | } |
43 | {-# NOINLINE globals #-} | 44 | {-# NOINLINE globals #-} |
44 | 45 | ||
46 | forkLabeled :: String -> IO () -> IO ThreadId | ||
47 | forkLabeled lbl action = do | ||
48 | t <- forkIO action | ||
49 | labelThread t lbl | ||
50 | return t | ||
51 | {-# INLINE forkLabeled #-} | ||
45 | 52 | ||
46 | forkIO :: IO () -> IO ThreadId | 53 | forkIO :: IO () -> IO ThreadId |
47 | forkIO = instrumented GHC.forkIO | 54 | forkIO = instrumented GHC.forkIO |