hsdev-0.3.3.1: Haskell development library

Safe HaskellSafe
LanguageHaskell98

Control.Concurrent.Worker

Synopsis

Documentation

data Worker m Source #

Constructors

Worker 

Fields

startWorker :: MonadIO m => (m () -> IO ()) -> (m () -> m ()) -> (m () -> m ()) -> IO (Worker m) Source #

Create new worker

workerAlive :: Worker m -> IO Bool Source #

Check whether worker alive

sendTask :: (MonadCatch m, MonadIO m) => Worker m -> m a -> IO (Async a) Source #

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