| Copyright | (c) Naoto Shimazaki 2017-2020 |
|---|---|
| License | MIT (see the file LICENSE) |
| Maintainer | https://github.com/nshimaza |
| Stability | experimental |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Control.Concurrent.HierarchyInternal
Description
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.
Constructors
| FinishMarker (MVar ()) |
Instances
| Eq FinishMarker Source # | |
Defined in Control.Concurrent.HierarchyInternal | |
Mutable map containing thread ID and finish marker.
Constructors
| ThreadMap (TVar (Map ThreadId FinishMarker)) |
Arguments
| :: 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.