async-manager- A thread manager for async

Safe HaskellNone




data AnyAsync Source

A existentially quantified wrapper for Async a


forall a . AnyAsync (Async a) 

newtype AsyncManager Source

An Async thread manager. Keeps track of allocated and running Async threads. Useful for ensure threads are cleaned up

newAsyncManager :: IO AsyncManager Source

Create a new empty manager

insert :: AsyncManager -> Async a -> IO () Source

Insert a new thread into the manager TODO: maybe I should check if the computation is still running

clear :: AsyncManager -> IO () Source

Cancel all threads and empty the manager

count :: AsyncManager -> IO Int Source

Thread count. Includes alive and dead threads

compact :: AsyncManager -> IO () Source

Remove references to dead threads

cancelWithManager :: AsyncManager -> Async a -> IO () Source

Cancel the thread and remove the entry from the manager

asyncWithManager :: AsyncManager -> IO a -> IO (Async a) Source

Create a new thread and add it to the manager