Running a "final" finaliser
Adrian Hey
ahey at iee.org
Wed Dec 31 10:05:35 EST 2003
On Wednesday 31 Dec 2003 8:56 am, Adrian Hey wrote:
> Intended use is something like this...
>
> {-# notInline libXYZRef #-}
> libXYZRef :: LibRef
> libXYZRef = unsafePerformIO newLibRef
>
> main :: IO ()
> main = finally (initLibXYZ >> userMain) (killLibRef libXYZRef
> shutDownLibXYZ)
> -- initLibXYZ and shutDownLibXYZ are Haskell bindings to functions supplied
> -- by libXYZ
Actually, using..
main = finally (initLibXYZ >> userMain)
(performGC >> killLibRef libXYZRef shutDownLibXYZ)
seems to fix the problem, which isn't too surprising I guess.
But then again, if this is a reliable solution there's no need
for LibRef after all :-)
Regards
--
Adrian Hey
More information about the Glasgow-haskell-users
mailing list