[GHC] #3473: System.Posix.Semaphore shouldn't create finalizers
with Foreign.newForeignPtr
GHC
trac at galois.com
Sat Aug 29 05:01:33 EDT 2009
#3473: System.Posix.Semaphore shouldn't create finalizers with
Foreign.newForeignPtr
-------------------+--------------------------------------------------------
Reporter: kaol | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/unix
Version: 6.10.4 | Severity: normal
Keywords: | Testcase:
Os: Linux | Architecture: x86
-------------------+--------------------------------------------------------
Running this program
{{{
import System.Posix.Semaphore
main = do
s <- semOpen "c" (OpenSemFlags True False) 0666 1
semThreadWait s
v <- semGetValue s
putStrLn "Type!"
a <- getLine
putStrLn $ "OK, " ++ a
semPost s
}}}
fails like this:
{{{
Type!
abc
OK, abc
sem: 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.
}}}
The attached patch for libraries/unix/System/Posix/Semaphore.hsc should
fix this.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3473>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list