Safe Haskell | Safe-Inferred |
---|
A simple thread management API inspired by the one in chapter 24 of Real World Haskell.
See http://book.realworldhaskell.org/read/concurrent-and-multicore-programming.html.
Intended to be imported qualified (suggestion: TM).
- data ThreadManager
- data ThreadStatus
- = Running
- | Finished
- | Threw SomeException
- make :: IO ThreadManager
- fork :: ThreadManager -> IO () -> IO ThreadId
- forkn :: ThreadManager -> Int -> IO () -> IO [ThreadId]
- getStatus :: ThreadManager -> ThreadId -> IO (Maybe ThreadStatus)
- waitFor :: ThreadManager -> ThreadId -> IO (Maybe ThreadStatus)
- waitForAll :: ThreadManager -> IO ()
Documentation
make :: IO ThreadManagerSource
Make a thread manager.
forkn :: ThreadManager -> Int -> IO () -> IO [ThreadId]Source
Make the given number of managed threads.
getStatus :: ThreadManager -> ThreadId -> IO (Maybe ThreadStatus)Source
Get the status of a managed thread.
waitFor :: ThreadManager -> ThreadId -> IO (Maybe ThreadStatus)Source
Block until a specific managed thread terminates.
waitForAll :: ThreadManager -> IO ()Source
Block until all managed threads terminate.