aboutsummaryrefslogtreecommitdiffhomepage
path: root/System/Posix
diff options
context:
space:
mode:
authorGravatar Simon Marlow <marlowsd@gmail.com>2012-10-01 11:46:33 +0100
committerGravatar Simon Marlow <marlowsd@gmail.com>2013-01-25 20:54:39 +0000
commitaf75e09945582b5e3b723f033216936121f3f65e (patch)
tree19e46fce90c9d0edfb7b48ed0641cdd9187f2088 /System/Posix
parent67c5131fb6c03cc4ec4a378b0f124bdeec71ed93 (diff)
Import waitpid() with interruptible
Diffstat (limited to 'System/Posix')
-rw-r--r--System/Posix/Process/Common.hsc11
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@,