thread-hierarchy-0.3.0.1: Simple Haskel thread management in hierarchical manner

Copyright(c) Naoto Shimazaki 2017
LicenseMIT (see the file LICENSE)
Maintainerhttps://github.com/nshimaza
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Control.Concurrent.HierarchyInternal

Description

Internal implementations of Control.Concurrent.Hierarchy

Synopsis

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 ()) 

newtype ThreadMap Source #

Mutable map containing thread ID and finish marker.

newThreadMap :: IO ThreadMap Source #

Create a new empty ThreadMap.

newChild Source #

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.

killThreadHierarchy Source #

Arguments

:: ThreadMap

ThreadMap containing threads to be killed

-> IO () 

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 #

Arguments

:: ThreadMap

ThreadMap containing threads to be killed

-> IO () 

Kill all thread registered in given ThreadMap. This internal version is only called from cleanup routine so this ignores ThreadKilled asynchronous exception.

cleanup :: FinishMarker -> ThreadMap -> ThreadMap -> IO () Source #

Thread clean up routine automatically installed by newChild. It first killThreadHierarchy all its child threads and unregister itself. This function is not an API function but for internal use only.