aboutsummaryrefslogtreecommitdiffhomepage
path: root/System/Posix/Unistd.hsc
diff options
context:
space:
mode:
authorGravatar stolz <unknown>2002-10-11 14:25:25 +0000
committerGravatar stolz <unknown>2002-10-11 14:25:25 +0000
commitef14d01e18d7f651142353b064802a57cb69d64f (patch)
tree45664828b64a5e99940c3a661fe994d085d183d4 /System/Posix/Unistd.hsc
parent1af096d3e286498e531ecb0542bd26997ab5fe06 (diff)
[project @ 2002-10-11 14:25:25 by stolz]
'usleep' nightmare: Sometimes return type is void, sometimes int.
Diffstat (limited to 'System/Posix/Unistd.hsc')
-rw-r--r--System/Posix/Unistd.hsc11
1 files changed, 11 insertions, 0 deletions
diff --git a/System/Posix/Unistd.hsc b/System/Posix/Unistd.hsc
index bdcbc34..affdc2e 100644
--- a/System/Posix/Unistd.hsc
+++ b/System/Posix/Unistd.hsc
@@ -72,6 +72,8 @@ module System.Posix.Unistd (
-}
) where
+#include "config.h"
+
import Foreign
import Foreign.C
import System.Posix.Types
@@ -182,10 +184,19 @@ foreign import ccall unsafe "sleep"
usleep :: Int -> IO ()
usleep 0 = return ()
+#ifdef USLEEP_RETURNS_VOID
+usleep usecs = c_usleep (fromIntegral usecs)
+#else
usleep usecs = throwErrnoIfMinus1_ "usleep" (c_usleep (fromIntegral usecs))
+#endif
+#ifdef USLEEP_RETURNS_VOID
+foreign import ccall unsafe "usleep"
+ c_usleep :: CUInt -> IO ()
+#else
foreign import ccall unsafe "usleep"
c_usleep :: CUInt -> IO CInt
+#endif
-- -----------------------------------------------------------------------------
-- System variables