[commit: unix] master: Import waitpid() with interruptible (af75e09)

Simon Marlow marlowsd at gmail.com
Wed Jan 30 12:04:08 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/unix

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/af75e09945582b5e3b723f033216936121f3f65e

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

commit af75e09945582b5e3b723f033216936121f3f65e
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Mon Oct 1 11:46:33 2012 +0100

    Import waitpid() with interruptible

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

 System/Posix/Process/Common.hsc |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc
index 5a1bed3..e11742a 100644
--- a/System/Posix/Process/Common.hsc
+++ b/System/Posix/Process/Common.hsc
@@ -1,4 +1,4 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE ForeignFunctionInterface, InterruptibleFFI #-}
 #ifdef __GLASGOW_HASKELL__
 {-# LANGUAGE Trustworthy #-}
 #endif
@@ -313,8 +313,13 @@ getProcessStatus block stopped pid =
       _  -> do ps <- readWaitStatus wstatp
 	       return (Just ps)
 
--- safe, because this call might block
-foreign import ccall safe "waitpid"
+#if __GLASGOW_HASKELL__ < 701
+-- not available prior to 7.1
+#define interruptible safe
+#endif
+
+-- safe/interruptible, because this call might block
+foreign import ccall interruptible "waitpid"
   c_waitpid :: CPid -> Ptr CInt -> CInt -> IO CPid
 
 -- | @'getGroupProcessStatus' blk stopped pgid@ calls @waitpid@,





More information about the ghc-commits mailing list