Skip to content

Commit be6d047

Browse files
committed
Fix 'semTrywait: invalid argument (Bad file descriptor)' wrt #218
1 parent 92f6e50 commit be6d047

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

System/Posix/Semaphore.hsc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE Safe #-}
2+
{-# LANGUAGE CApiFFI #-}
23
-----------------------------------------------------------------------------
34
-- |
45
-- Module : System.Posix.Semaphore
@@ -110,18 +111,18 @@ semGetValue_ sem ptr = do throwErrnoIfMinus1Retry_ "semGetValue" $
110111
cint <- peek ptr
111112
return $ fromEnum cint
112113

113-
foreign import ccall safe "sem_open"
114+
foreign import capi safe "semaphore.h sem_open"
114115
sem_open :: CString -> CInt -> CMode -> CUInt -> IO (Ptr ())
115-
foreign import ccall safe "sem_close"
116+
foreign import capi safe "semaphore.h sem_close"
116117
sem_close :: Ptr () -> IO CInt
117-
foreign import ccall safe "sem_unlink"
118+
foreign import capi safe "semaphore.h sem_unlink"
118119
sem_unlink :: CString -> IO CInt
119120

120-
foreign import ccall safe "sem_wait"
121+
foreign import capi safe "semaphore.h sem_wait"
121122
sem_wait :: Ptr () -> IO CInt
122-
foreign import ccall safe "sem_trywait"
123+
foreign import capi safe "semaphore.h sem_trywait"
123124
sem_trywait :: Ptr () -> IO CInt
124-
foreign import ccall safe "sem_post"
125+
foreign import capi safe "semaphore.h sem_post"
125126
sem_post :: Ptr () -> IO CInt
126-
foreign import ccall safe "sem_getvalue"
127+
foreign import capi safe "semaphore.h sem_getvalue"
127128
sem_getvalue :: Ptr () -> Ptr CInt -> IO Int

0 commit comments

Comments
 (0)