problems with semaphores in ghc-6.10.4 unix-188.8.131.52
module Main ( main ) where import System ( getArgs ) import Control.Monad import Data.List import System.Posix.Semaphore import System.Posix.Files main = do c <- liftM (head . head) getArgs putStrLn $ "Writing " ++ [c] ++ " to file foo" s <- semOpen "fooSemaphor" (OpenSemFlags True False) ownerModes 1 semWait s appendFile "foo" $ replicate 99999999 c semPost s semUnlink "fooSemaphor" putStrLn $ "Done writing " ++ [c]
When called like this "./locking2 a & ./locking2 b" I get:
locking2: fooSemaphor: semUnlink: does not exist (No such file or directory) locking2: error: a C finalizer called back into Haskell. This was previously allowed, but is disallowed in GHC 6.10.2 and later. To create finalizers that may call back into Haskll, use Foreign.Concurrent.newForeignPtr instead of Foreign.newForeignPtr.
I dont know what this means, but it looks as if some things are going wrong internally.