Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- data Worker m = Worker {
- workerChan :: Chan (Async (), m ())
- workerTask :: MVar (Async ())
- data WorkerStopped = WorkerStopped
- startWorker :: MonadIO m => (m () -> IO ()) -> (m () -> m ()) -> (m () -> m ()) -> IO (Worker m)
- workerAlive :: Worker m -> IO Bool
- workerDone :: Worker m -> IO Bool
- sendTask :: (MonadCatch m, MonadIO m) => Worker m -> m a -> IO (Async a)
- stopWorker :: Worker m -> IO ()
- joinWorker :: Worker m -> IO ()
- syncTask :: (MonadCatch m, MonadIO m) => Worker m -> IO ()
- inWorkerWith :: (MonadIO m, MonadCatch m, MonadIO n) => (SomeException -> n a) -> Worker m -> m a -> n a
- inWorker :: (MonadIO m, MonadCatch m) => Worker m -> m a -> IO a
- module Control.Concurrent.Async
Documentation
Worker | |
|
data WorkerStopped Source #
Instances
Show WorkerStopped Source # | |
Defined in Control.Concurrent.Worker showsPrec :: Int -> WorkerStopped -> ShowS # show :: WorkerStopped -> String # showList :: [WorkerStopped] -> ShowS # | |
Exception WorkerStopped Source # | |
Defined in Control.Concurrent.Worker |
startWorker :: MonadIO m => (m () -> IO ()) -> (m () -> m ()) -> (m () -> m ()) -> IO (Worker m) Source #
Create new worker
stopWorker :: Worker m -> IO () Source #
Close worker channel
joinWorker :: Worker m -> IO () Source #
Stop worker and wait for it
syncTask :: (MonadCatch m, MonadIO m) => Worker m -> IO () Source #
Send empty task and wait until worker run it
inWorkerWith :: (MonadIO m, MonadCatch m, MonadIO n) => (SomeException -> n a) -> Worker m -> m a -> n a Source #
Run action in worker and wait for result
inWorker :: (MonadIO m, MonadCatch m) => Worker m -> m a -> IO a Source #
Run action in worker and wait for result
module Control.Concurrent.Async