Copyright | (c) Alexey Kuleshevich 2020 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <lehins@yandex.ru> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data GlobalScheduler
- globalScheduler :: GlobalScheduler
- newGlobalScheduler :: MonadIO m => Comp -> m GlobalScheduler
- withGlobalScheduler_ :: MonadUnliftIO m => GlobalScheduler -> (Scheduler RealWorld () -> m a) -> m ()
Documentation
data GlobalScheduler Source #
A thread safe wrapper around Scheduler
, which allows it to be reused indefinitely
and globally if need be. There is one already created in this library:
globalScheduler
Since: 1.5.0
globalScheduler :: GlobalScheduler Source #
Global scheduler with Par
computation strategy that can be used anytime using
withGlobalScheduler_
newGlobalScheduler :: MonadIO m => Comp -> m GlobalScheduler Source #
Create a new global scheduler, in case a single one globalScheduler
is not
sufficient. It is important to note that too much parallelization can significantly
degrate performance, therefore it is best not to use more than one scheduler at a time.
Since: 1.5.0
withGlobalScheduler_ :: MonadUnliftIO m => GlobalScheduler -> (Scheduler RealWorld () -> m a) -> m () Source #
Use the global scheduler if it is not busy, otherwise initialize a temporary one. It means that this function by itself will not block, but if the same global scheduler used concurrently other schedulers might get created.
Since: 1.5.0