thread-utils-finalizers 0.1.0.0 → 0.1.1.0
raw patch · 2 files changed
+16/−4 lines, 2 files
Files
src/Control/Concurrent/Thread/Finalizers.hs view
@@ -1,12 +1,16 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE UnboxedTuples #-}-module Control.Concurrent.Thread.Finalizers where+module Control.Concurrent.Thread.Finalizers+ ( mkWeakThreadIdWithFinalizer+ , addThreadFinalizer+ , finalizeThread+ ) where import Control.Concurrent import Control.Exception import Control.Monad ( void ) import GHC.IO (IO(..)) import GHC.Prim ( mkWeak# )-import GHC.Weak ( Weak(..) )+import GHC.Weak ( Weak(..), finalize ) import GHC.Conc.Sync ( ThreadId(..) ) -- | A variant of 'Control.Concurrent.mkWeakThreadId' that supports@@ -40,3 +44,11 @@ -} addThreadFinalizer :: ThreadId -> IO () -> IO () addThreadFinalizer tid m = void $ mkWeakThreadIdWithFinalizer tid m++{-|+ Run a thread's finalizers. This is just a convenience alias for 'System.Mem.Weak.finalize'.++ The thread can still be used afterwards, it will simply not run the associated finalizers again.+-}+finalizeThread :: Weak ThreadId -> IO ()+finalizeThread = finalize
thread-utils-finalizers.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.35.2. -- -- see: https://github.com/sol/hpack name: thread-utils-finalizers-version: 0.1.0.0+version: 0.1.1.0 synopsis: Perform finalization for threads. description: Please see the README on GitHub at <https://github.com/iand675/thread-finalizers#readme> category: Concurrency