Maintainer | Bas van Dijk <v.dijk.bas@gmail.com> , Roel van Dijk <vandijk.roel@gmail.com> |
---|
This module extends Control.Concurrent.Thread
with the ability to wait for
a group of threads to terminate.
This module exports equivalently named functions from Control.Concurrent
and Control.Concurrent.Thread
. Avoid ambiguities by importing one or both
qualified. We suggest importing this module like:
import Control.Concurrent.Thread.Group ( ThreadGroup ) import qualified Control.Concurrent.Thread.Group as ThreadGroup ( ... )
- data ThreadGroup
- new :: IO ThreadGroup
- forkIO :: ThreadGroup -> IO α -> IO (ThreadId α)
- forkOS :: ThreadGroup -> IO α -> IO (ThreadId α)
- wait :: ThreadGroup -> IO ()
- isAnyRunning :: ThreadGroup -> IO Bool
Creating
Create a new empty group.
Forking threads
forkIO :: ThreadGroup -> IO α -> IO (ThreadId α)Source
Same as Control.Concurrent.Thread.
but additionaly adds
the thread to the group.
forkIO
forkOS :: ThreadGroup -> IO α -> IO (ThreadId α)Source
Same as Control.Concurrent.Thread.
but additionaly adds
the thread to the group.
forkOS
Waiting & Status
wait :: ThreadGroup -> IO ()Source
Block until all threads, that were added to the group have terminated.
isAnyRunning :: ThreadGroup -> IO BoolSource