Copyright | (c) Naoto Shimazaki 2017 |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | https://github.com/nshimaza |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Internal implementations of Control.Concurrent.Hierarchy
Synopsis
- newtype FinishMarker = FinishMarker (MVar ())
- newtype ThreadMap = ThreadMap (TVar (Map ThreadId FinishMarker))
- newThreadMap :: IO ThreadMap
- newChild :: ThreadMap -> (ThreadMap -> IO ()) -> IO ThreadId
- killThreadHierarchy :: ThreadMap -> IO ()
- killThreadHierarchyInternal :: ThreadMap -> IO ()
- cleanup :: FinishMarker -> ThreadMap -> ThreadMap -> IO ()
Documentation
newtype FinishMarker Source #
FinishMarker is created as empty MVar when a thread is created. It is automatically filled by () when the thread exits.
FinishMarker (MVar ()) |
Instances
Eq FinishMarker Source # | |
Defined in Control.Concurrent.HierarchyInternal (==) :: FinishMarker -> FinishMarker -> Bool # (/=) :: FinishMarker -> FinishMarker -> Bool # |
Mutable map containing thread ID and finish marker.
:: ThreadMap | ThreadMap where newly created thread will be registered. |
-> (ThreadMap -> IO ()) | Action executed within the new thread. |
-> IO ThreadId | newChild returns ThreadId of created thread. |
Create a new thread and register it to given ThreadMap
.
Kill all thread registered in given ThreadMap
.
This version is exposed as API. This is not called from cleanup routine.
Thus it doesn't ignore asynchronous exceptions.
killThreadHierarchyInternal Source #
Kill all thread registered in given ThreadMap
.
This internal version is only called from cleanup routine so
this ignores ThreadKilled asynchronous exception.