Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This is a wrapped version of Control.Concurrent.Thread with
types generalised from IO
to all monads in either MonadBase
or MonadBaseControl
.
- fork :: MonadBaseControl IO m => m a -> m (ThreadId, m (Result a))
- forkOS :: MonadBaseControl IO m => m a -> m (ThreadId, m (Result a))
- forkOn :: MonadBaseControl IO m => Int -> m a -> m (ThreadId, m (Result a))
- forkWithUnmask :: MonadBaseControl IO m => ((forall b. m b -> m b) -> m a) -> m (ThreadId, m (Result a))
- forkOnWithUnmask :: MonadBaseControl IO m => Int -> ((forall b. m b -> m b) -> m a) -> m (ThreadId, m (Result a))
- type Result a = Either SomeException a
- result :: MonadBase IO m => Result a -> m a
Forking threads
fork :: MonadBaseControl IO m => m a -> m (ThreadId, m (Result a)) Source
Generalized version of forkIO
.
forkOS :: MonadBaseControl IO m => m a -> m (ThreadId, m (Result a)) Source
Generalized version of forkOS
.
forkOn :: MonadBaseControl IO m => Int -> m a -> m (ThreadId, m (Result a)) Source
Generalized version of forkOn
.
forkWithUnmask :: MonadBaseControl IO m => ((forall b. m b -> m b) -> m a) -> m (ThreadId, m (Result a)) Source
Generalized version of forkIOWithUnmask
.
forkOnWithUnmask :: MonadBaseControl IO m => Int -> ((forall b. m b -> m b) -> m a) -> m (ThreadId, m (Result a)) Source
Generalized version of forkOnWithUnmask
.
Results
type Result a = Either SomeException a
A result of a thread is either some exception that was thrown in the thread and wasn't catched or the actual value that was returned by the thread.