Community
Modules 4

Control.Concurrent.Async.Warden

A more flexible way to create Asyncs and have them automatically cancelled when the Warden is shut down.

newtype Warden

A Warden is an owner of Asyncs which cancels them on shutdown.

Nothing in the MVar means the Warden has been shut down.

withWarden :: (Warden -> IO a) -> IO a

Run the action with a new Warden, and call shutdown when the action exits.

create :: IO Warden

Create a new Warden.

shutdown :: Warden -> IO ()

Shutdown a Warden, calling cancel on all owned threads. Subsequent calls to spawn and shutdown will be no-ops.

Note that any exceptions thrown by the threads will be ignored. If you want exceptions to be propagated, either call `wait` explicitly on the Async, or use link.

spawn :: Warden -> IO a -> IO (Async a)

Spawn a new thread owned by the Warden.

spawn_ :: Warden -> IO () -> IO ()

Spawn a new thread owned by the Warden.

spawnMask :: Warden -> ((forall b. IO b -> IO b) -> IO a) -> IO (Async a)

Spawn a thread with masked exceptions and pass an unmask function to the action.

Instances

2
  • instance Show WardenException
  • instance Exception WardenException
Build record and source files

Community contribution. The service has not verified this documentation.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-aa6debbd-web-3

Metadata snapshot: 19a17fec6f51aec017fc45abde955c1e4fb18fa220fb1acb9d601743c725a768

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.