Safe Haskell | None |
---|---|
Language | Haskell2010 |
Unlifted Control.Concurrent.Async.
Since: unliftio-0.1.0.0
Synopsis
- data Async a
- async :: MonadUnliftIO m => m a -> m (Async a)
- asyncBound :: MonadUnliftIO m => m a -> m (Async a)
- asyncOn :: MonadUnliftIO m => Int -> m a -> m (Async a)
- asyncWithUnmask :: MonadUnliftIO m => ((forall b. m b -> m b) -> m a) -> m (Async a)
- asyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall b. m b -> m b) -> m a) -> m (Async a)
- withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b
- withAsyncBound :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b
- withAsyncOn :: MonadUnliftIO m => Int -> m a -> (Async a -> m b) -> m b
- withAsyncWithUnmask :: MonadUnliftIO m => ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b
- withAsyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b
- wait :: MonadIO m => Async a -> m a
- poll :: MonadIO m => Async a -> m (Maybe (Either SomeException a))
- waitCatch :: MonadIO m => Async a -> m (Either SomeException a)
- cancel :: MonadIO m => Async a -> m ()
- uninterruptibleCancel :: MonadIO m => Async a -> m ()
- cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m ()
- asyncThreadId :: Async a -> ThreadId
- waitSTM :: Async a -> STM a
- pollSTM :: Async a -> STM (Maybe (Either SomeException a))
- waitCatchSTM :: Async a -> STM (Either SomeException a)
- waitAny :: MonadIO m => [Async a] -> m (Async a, a)
- waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)
- waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a)
- waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)
- waitEither :: MonadIO m => Async a -> Async b -> m (Either a b)
- waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))
- waitEitherCancel :: MonadIO m => Async a -> Async b -> m (Either a b)
- waitEitherCatchCancel :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))
- waitEither_ :: MonadIO m => Async a -> Async b -> m ()
- waitBoth :: MonadIO m => Async a -> Async b -> m (a, b)
- waitAnySTM :: [Async a] -> STM (Async a, a)
- waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a)
- waitEitherSTM :: Async a -> Async b -> STM (Either a b)
- waitEitherCatchSTM :: Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b))
- waitEitherSTM_ :: Async a -> Async b -> STM ()
- waitBothSTM :: Async a -> Async b -> STM (a, b)
- link :: MonadIO m => Async a -> m ()
- link2 :: MonadIO m => Async a -> Async b -> m ()
- race :: MonadUnliftIO m => m a -> m b -> m (Either a b)
- race_ :: MonadUnliftIO m => m a -> m b -> m ()
- concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b)
- concurrently_ :: MonadUnliftIO m => m a -> m b -> m ()
- mapConcurrently :: MonadUnliftIO m => Traversable t => (a -> m b) -> t a -> m (t b)
- forConcurrently :: MonadUnliftIO m => Traversable t => t a -> (a -> m b) -> m (t b)
- mapConcurrently_ :: MonadUnliftIO m => Foldable f => (a -> m b) -> f a -> m ()
- forConcurrently_ :: MonadUnliftIO m => Foldable f => f a -> (a -> m b) -> m ()
- replicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a]
- replicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> m ()
- newtype Concurrently m a = Concurrently {
- runConcurrently :: m a
Asynchronous actions
An asynchronous action spawned by async
or withAsync
.
Asynchronous actions are executed in a separate thread, and
operations are provided for waiting for asynchronous actions to
complete and obtaining their results (see e.g. wait
).
Spawning
asyncBound :: MonadUnliftIO m => m a -> m (Async a) Source #
Unlifted asyncBound
.
Since: unliftio-0.1.0.0
asyncOn :: MonadUnliftIO m => Int -> m a -> m (Async a) Source #
Unlifted asyncOn
.
Since: unliftio-0.1.0.0
asyncWithUnmask :: MonadUnliftIO m => ((forall b. m b -> m b) -> m a) -> m (Async a) Source #
Unlifted asyncWithUnmask
.
Since: unliftio-0.1.0.0
asyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall b. m b -> m b) -> m a) -> m (Async a) Source #
Unlifted asyncOnWithUnmask
.
Since: unliftio-0.1.0.0
Spawning with automatic cancel
ation
withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b Source #
Unlifted withAsync
.
Since: unliftio-0.1.0.0
withAsyncBound :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b Source #
Unlifted withAsyncBound
.
Since: unliftio-0.1.0.0
withAsyncOn :: MonadUnliftIO m => Int -> m a -> (Async a -> m b) -> m b Source #
Unlifted withAsyncOn
.
Since: unliftio-0.1.0.0
withAsyncWithUnmask :: MonadUnliftIO m => ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b Source #
Unlifted withAsyncWithUnmask
.
Since: unliftio-0.1.0.0
withAsyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall c. m c -> m c) -> m a) -> (Async a -> m b) -> m b Source #
Unlifted withAsyncOnWithMask
.
Since: unliftio-0.1.0.0
Querying Async
s
poll :: MonadIO m => Async a -> m (Maybe (Either SomeException a)) Source #
Lifted poll
.
Since: unliftio-0.1.0.0
waitCatch :: MonadIO m => Async a -> m (Either SomeException a) Source #
Lifted waitCatch
.
Since: unliftio-0.1.0.0
uninterruptibleCancel :: MonadIO m => Async a -> m () Source #
Lifted uninterruptibleCancel
.
Since: unliftio-0.1.0.0
cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m () Source #
Lifted cancelWith
. Additionally uses toAsyncException
to
ensure async exception safety.
Since: unliftio-0.1.0.0
STM operations
pollSTM :: Async a -> STM (Maybe (Either SomeException a)) #
A version of poll
that can be used inside an STM transaction.
waitCatchSTM :: Async a -> STM (Either SomeException a) #
A version of waitCatch
that can be used inside an STM transaction.
Waiting for multiple Async
s
waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a) Source #
Lifted waitAnyCatch
.
Since: unliftio-0.1.0.0
waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a) Source #
Lifted waitAnyCancel
.
Since: unliftio-0.1.0.0
waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a) Source #
Lifted waitAnyCatchCancel
.
Since: unliftio-0.1.0.0
waitEither :: MonadIO m => Async a -> Async b -> m (Either a b) Source #
Lifted waitEither
.
Since: unliftio-0.1.0.0
waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b)) Source #
Lifted waitEitherCatch
.
Since: unliftio-0.1.0.0
waitEitherCancel :: MonadIO m => Async a -> Async b -> m (Either a b) Source #
Lifted waitEitherCancel
.
Since: unliftio-0.1.0.0
waitEitherCatchCancel :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b)) Source #
Lifted waitEitherCatchCancel
.
Since: unliftio-0.1.0.0
waitEither_ :: MonadIO m => Async a -> Async b -> m () Source #
Lifted waitEither_
.
Since: unliftio-0.1.0.0
waitBoth :: MonadIO m => Async a -> Async b -> m (a, b) Source #
Lifted waitBoth
.
Since: unliftio-0.1.0.0
Waiting for multiple Async
s in STM
waitAnySTM :: [Async a] -> STM (Async a, a) #
A version of waitAny
that can be used inside an STM transaction.
Since: async-2.1.0
waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a) #
A version of waitAnyCatch
that can be used inside an STM transaction.
Since: async-2.1.0
waitEitherSTM :: Async a -> Async b -> STM (Either a b) #
A version of waitEither
that can be used inside an STM transaction.
Since: async-2.1.0
waitEitherCatchSTM :: Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b)) #
A version of waitEitherCatch
that can be used inside an STM transaction.
Since: async-2.1.0
waitEitherSTM_ :: Async a -> Async b -> STM () #
A version of waitEither_
that can be used inside an STM transaction.
Since: async-2.1.0
waitBothSTM :: Async a -> Async b -> STM (a, b) #
A version of waitBoth
that can be used inside an STM transaction.
Since: async-2.1.0
Linking
Convenient utilities
race :: MonadUnliftIO m => m a -> m b -> m (Either a b) Source #
Unlifted race
.
Since: unliftio-0.1.0.0
race_ :: MonadUnliftIO m => m a -> m b -> m () Source #
Unlifted race_
.
Since: unliftio-0.1.0.0
concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b) Source #
Unlifted concurrently
.
Since: unliftio-0.1.0.0
concurrently_ :: MonadUnliftIO m => m a -> m b -> m () Source #
Unlifted concurrently_
.
Since: unliftio-0.1.0.0
mapConcurrently :: MonadUnliftIO m => Traversable t => (a -> m b) -> t a -> m (t b) Source #
Unlifted mapConcurrently
.
Since: unliftio-0.1.0.0
forConcurrently :: MonadUnliftIO m => Traversable t => t a -> (a -> m b) -> m (t b) Source #
Unlifted forConcurrently
.
Since: unliftio-0.1.0.0
mapConcurrently_ :: MonadUnliftIO m => Foldable f => (a -> m b) -> f a -> m () Source #
Unlifted mapConcurrently_
.
Since: unliftio-0.1.0.0
forConcurrently_ :: MonadUnliftIO m => Foldable f => f a -> (a -> m b) -> m () Source #
Unlifted forConcurrently_
.
Since: unliftio-0.1.0.0
replicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a] Source #
Unlifted replicateConcurrently
.
Since: unliftio-0.1.0.0
replicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> m () Source #
Unlifted replicateConcurrently_
.
Since: unliftio-0.1.0.0
newtype Concurrently m a Source #
Unlifted Concurrently
.
Since: unliftio-0.1.0.0
Concurrently | |
|