async-1.3: Asynchronous Computations

Portabilityportable
Stabilitystable
Maintainersimons@cryp.to

Control.Async

Description

An implementation of IO computations that return their value asynchronously.

Synopsis

Documentation

data Async a Source

Async a represents a value a that is being computed asynchronously, i.e. a value that is going to become available at some point in the future.

forkAsync :: IO a -> IO (Async a)Source

Start an asynchronous computation.

throwToAsync :: Exception e => Async a -> e -> IO ()Source

Throw an asynchronous exception to the thread that performs the computation associated with this value.

killAsync :: Async a -> IO ()Source

Abort the asynchronous computation associated with this value.

isReadyAsync :: Async a -> IO BoolSource

Test whether the asynchronous value has become available.

waitForAsync :: Async a -> IO aSource

Wait for the asynchronous value to become available, and retrieve it. If the computation that generated the value has thrown an exception, then that exception will be raised here.

parIO :: IO a -> IO a -> IO aSource

Run both computations in parallel and return the a value of the computation that terminates first. An exception in either of the two computations aborts the entire parIO computation.