[commit: packages/unix] master: Add `forkProcessWithUnmask` function (17192d8)

git at git.haskell.org git at git.haskell.org
Fri Nov 8 12:16:11 UTC 2013


Repository : ssh://git@git.haskell.org/unix

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/17192d89e642c463a1987fa3cc5cca2eb546bec7/unix

>---------------------------------------------------------------

commit 17192d89e642c463a1987fa3cc5cca2eb546bec7
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Fri Nov 8 12:48:54 2013 +0100

    Add `forkProcessWithUnmask` function
    
    This seemed to be an obvious addition while working on #8433.
    
    Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>


>---------------------------------------------------------------

17192d89e642c463a1987fa3cc5cca2eb546bec7
 System/Posix/Process/ByteString.hsc |    1 +
 System/Posix/Process/Common.hsc     |   10 +++++++++-
 changelog                           |    4 ++++
 unix.cabal                          |    1 +
 4 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/System/Posix/Process/ByteString.hsc b/System/Posix/Process/ByteString.hsc
index 30f40cd..4c6840a 100644
--- a/System/Posix/Process/ByteString.hsc
+++ b/System/Posix/Process/ByteString.hsc
@@ -22,6 +22,7 @@ module System.Posix.Process.ByteString (
     -- ** Forking and executing
 #ifdef __GLASGOW_HASKELL__
     forkProcess,
+    forkProcessWithUnmask,
 #endif
     executeFile,
     
diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc
index 1b504df..b760caa 100644
--- a/System/Posix/Process/Common.hsc
+++ b/System/Posix/Process/Common.hsc
@@ -1,4 +1,4 @@
-{-# LANGUAGE InterruptibleFFI #-}
+{-# LANGUAGE InterruptibleFFI, RankNTypes #-}
 #ifdef __GLASGOW_HASKELL__
 {-# LANGUAGE Trustworthy #-}
 #endif
@@ -23,6 +23,7 @@ module System.Posix.Process.Common (
     -- ** Forking and executing
 #ifdef __GLASGOW_HASKELL__
     forkProcess,
+    forkProcessWithUnmask,
 #endif
 
     -- ** Exiting
@@ -306,6 +307,13 @@ forkProcess action = do
     (\stable -> throwErrnoIfMinus1 "forkProcess" (forkProcessPrim stable))
 
 foreign import ccall "forkProcess" forkProcessPrim :: StablePtr (IO ()) -> IO CPid
+
+-- | Variant of 'forkProcess' in the style of 'forkIOWithUnmask'.
+--
+-- /Since: 2.7.0.0/
+forkProcessWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ProcessID
+forkProcessWithUnmask action = forkProcess (action unsafeUnmask)
+
 #endif /* __GLASGOW_HASKELL__ */
 
 -- -----------------------------------------------------------------------------
diff --git a/changelog b/changelog
index ec0fbc8..ce72345 100644
--- a/changelog
+++ b/changelog
@@ -2,6 +2,8 @@
 
 2.7.0.0  Nov 2013
 
+        * New `forkProcessWithUnmask` function in the style of `forkIOWithUnmask`
+
         * Change `forkProcess` to inherit the exception masking state of its caller
 
         * Add new `Bool` flag to `ProcessStatus(Terminated)` constructor
@@ -26,6 +28,8 @@
 
         * Fix library detection of `shm*` on openSUSE (#8350)
 
+        * Minor documentation fixes/updates
+
         * Update package to `cabal-version >= 1.10` format
 
 2.6.0.1  Jan 2013
diff --git a/unix.cabal b/unix.cabal
index 2f729ba..3ad3c98 100644
--- a/unix.cabal
+++ b/unix.cabal
@@ -54,6 +54,7 @@ library
         InterruptibleFFI
         NoMonomorphismRestriction
         OverloadedStrings
+        RankNTypes
 
     if impl(ghc)
         other-extensions:



More information about the ghc-commits mailing list