hsdev-0.1.7.2: Haskell development library and tool with support of autocompletion, symbol info, go to declaration, find references etc.

Safe HaskellSafe
LanguageHaskell98

Control.Concurrent.Worker

Synopsis

Documentation

data Worker m Source

Constructors

Worker 

Fields

workerChan :: Chan (Async (), m ())
 
workerWrap :: forall a. m a -> m a
 
workerTask :: MVar (Async ())
 
workerTouch :: IO ()
 

startWorker :: MonadIO m => (m () -> IO ()) -> (m () -> m ()) -> (forall a. m a -> m a) -> IO (Worker m) Source

Create new worker

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

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

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

inWorker_ :: (MonadIO m, MonadCatch m) => Worker m -> m a -> ExceptT SomeException IO a Source

Run action in worker and wait for result