diff options
author | Joey Adams <joeyadams3.14159@gmail.com> | 2013-06-21 23:19:34 -0400 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2015-10-13 01:12:04 -0500 |
commit | dec5cd4085488686b5ed50bb26ccbc0ba7b645ec (patch) | |
tree | 145d8462c956fa31180d667b5d09cc6cb890d45e /libraries | |
parent | e5bfd704a6391e74f3797d78d19c4e4877f512da (diff) | |
download | haskell-dec5cd4085488686b5ed50bb26ccbc0ba7b645ec.tar.gz |
base: Add forkOSWithUnmask
Fixes #8010, according to the specified libraries proposal. [1]
Also, some minor wordsmithing.
[1] http://thread.gmane.org/gmane.comp.lang.haskell.libraries/22709
Signed-off-by: Austin Seipp <austin@well-typed.com>
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/Control/Concurrent.hs | 9 | ||||
-rw-r--r-- | libraries/base/changelog.md | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/libraries/base/Control/Concurrent.hs b/libraries/base/Control/Concurrent.hs index 35248bfba3..1786c3ded3 100644 --- a/libraries/base/Control/Concurrent.hs +++ b/libraries/base/Control/Concurrent.hs @@ -3,6 +3,7 @@ , MagicHash , UnboxedTuples , ScopedTypeVariables + , RankNTypes #-} {-# OPTIONS_GHC -fno-warn-deprecations #-} -- kludge for the Control.Concurrent.QSem, Control.Concurrent.QSemN @@ -73,6 +74,7 @@ module Control.Concurrent ( -- $boundthreads rtsSupportsBoundThreads, forkOS, + forkOSWithUnmask, isCurrentThreadBound, runInBoundThread, runInUnboundThread, @@ -180,7 +182,7 @@ attribute will block all other threads. -} --- | fork a thread and call the supplied function when the thread is about +-- | Fork a thread and call the supplied function when the thread is about -- to terminate, with an exception or a returned value. The function is -- called with asynchronous exceptions masked. -- @@ -316,6 +318,11 @@ forkOS action0 return tid | otherwise = failNonThreaded +-- | Like 'forkIOWithUnmask', but the child thread is a bound thread, +-- as with 'forkOS'. +forkOSWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId +forkOSWithUnmask io = forkOS (io unsafeUnmask) + -- | Returns 'True' if the calling thread is /bound/, that is, if it is -- safe to use foreign libraries that rely on thread-local state from the -- calling thread. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 7c4bf770f4..24a6e7fd5c 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -67,7 +67,11 @@ unlifted types (#10868) * Keep `shift{L,R}` on `Integer` with negative shift-arguments from - segfaulting (#10571) + segfaulting (#10571) + + * Add `forkOSWithUnmask` to `Control.Concurrent`, which is like + `forkIOWithUnmask`, but the child is run in a bound thread. + ## 4.8.1.0 *Jul 2015* |