Maintainer | Bas van Dijk <v.dijk.bas@gmail.com> |
---|
Concurrently executing regions.
This module exports functions with equivalent names from Control.Concurrent
and GHC.Conc
. May I suggest you import this module qualified as in:
import qualified Control.Monad.Trans.Region.Concurrent as Region
Documentation
forkIO :: MonadIO pr => RegionT s IO () -> RegionT s pr ThreadIdSource
Return a region which executes the given region in a new thread.
Note that the forked region has the same type variable s
as the resulting
region. This means that all values which can be referenced in the resulting
region can also be referenced in the forked region.
For example the following is allowed:
runRegionT
$ do regionalHndl <- open resource threadId <- Region.forkIO
$ doSomethingWith regionalHndl doSomethingElseWith regionalHndl
Note that the regionalHndl
and all other resources opened in the current
thread are closed only when the current thread or the forked thread terminates
whichever comes last.