| Safe Haskell | Safe |
|---|
Scheduler.Internal
- data SchedulerIO s a where
- SchedulerIO :: Scheduler s => IO a -> SchedulerIO s a
- unsafeRunSchedulerIO :: Scheduler s => SchedulerIO s a -> IO a
- class Scheduler s where
- schedule :: s -> SchedulerIO s () -> IO Disposable
- schedulerMain :: s -> IO ()
- newtype BackgroundScheduler = BackgroundScheduler (TQueue (ScheduledAction BackgroundScheduler))
- data ScheduledAction s
- newScheduledAction :: Scheduler s => SchedulerIO s () -> IO (ScheduledAction s, Disposable)
- executeScheduledAction :: Scheduler s => s -> ScheduledAction s -> IO ()
Documentation
data SchedulerIO s a whereSource
An IO computation that must be performed in a scheduler of type s.
Constructors
| SchedulerIO :: Scheduler s => IO a -> SchedulerIO s a |
Instances
| Scheduler s => Monad (SchedulerIO s) | |
| Functor (SchedulerIO s) | |
| Scheduler s => Applicative (SchedulerIO s) | |
| Scheduler s => MonadIO (SchedulerIO s) | |
| (Scheduler s, Show v) => Show (SchedulerIO s v) | Unsafely executes a |
unsafeRunSchedulerIO :: Scheduler s => SchedulerIO s a -> IO aSource
Extracts the underlying IO action from a SchedulerIO action.
This can be unsafe because the type system does not have enough information to determine whether the calling code is running on an appropriate scheduler.
Represents a queue of IO actions which can be executed in FIFO order.
Methods
schedule :: s -> SchedulerIO s () -> IO DisposableSource
Schedules an action on the scheduler. Returns a disposable which can be used to cancel it.
schedulerMain :: s -> IO ()Source
Executes all current and future actions enqueued on the given scheduler.
newtype BackgroundScheduler Source
A scheduler which runs enqueued actions in a dedicated background thread.
Constructors
| BackgroundScheduler (TQueue (ScheduledAction BackgroundScheduler)) |
Instances
data ScheduledAction s Source
Represents an action on a scheduler, along with a flag indicating whether it should be canceled.
newScheduledAction :: Scheduler s => SchedulerIO s () -> IO (ScheduledAction s, Disposable)Source
Creates a new scheduled action, and returns a disposable which can be used to cancel it.
executeScheduledAction :: Scheduler s => s -> ScheduledAction s -> IO ()Source
Executes the given action, then re-enters schedulerMain.