FerroScheduler
struct · ferroui-reactiveui-controls · v0.5.0
struct FerroScheduler
The scheduler of the user-interface thread: it runs its work on the thread of a
Dispatcher, at a priority, and coalesces the work scheduled before the dispatcher runs it
into one job of the dispatcher (a drain).
Work runs in the jobs of the dispatcher, never inline in schedule;
disposing scheduled work that has not started drops it, and disposing work that has started
disposes what the work returned. Delayed work waits on a DispatcherTimer.
RxSchedulers::set_main_thread_scheduler
takes FerroScheduler::instance when the application uses ReactiveUI.
Deviation (DEVIATIONS.md, ReactiveUI controls): the work is not Send, as the observables of
the port are not (docs/porting/reactive.md, section 5.1): the scheduler posts its drains with
Dispatcher::post_local and is used on the thread of its dispatcher, where upstream may
schedule from any thread. The shared instance and the schedulers of other dispatchers are kept
per thread. The constructor that takes the posting and the timers of a test (internal upstream)
is not ported.
Members
newwith_dispatcherwith_priorityinstancefor_dispatcherdispatcherprioritycheck_accessinstall_on_ui_thread
new
fn new() -> Rc<Self>
A scheduler of the dispatcher of the user-interface thread at
DispatcherPriority::BACKGROUND (new FerroScheduler(Dispatcher.UIThread)). Most code
takes the shared one, instance.
with_dispatcher
fn with_dispatcher(dispatcher: &Arc<Dispatcher>) -> Rc<Self>
A scheduler of dispatcher at DispatcherPriority::BACKGROUND (FerroScheduler(Dispatcher)).
with_priority
fn with_priority(dispatcher: &Arc<Dispatcher>, priority: DispatcherPriority) -> Rc<Self>
A scheduler of dispatcher that posts its drains and starts its timers at priority
(FerroScheduler(Dispatcher, DispatcherPriority)).
instance
fn instance() -> Rc<Self>
The shared scheduler of the dispatcher of the user-interface thread, at
DispatcherPriority::BACKGROUND (Instance). A new one is made when the dispatcher of
the user-interface thread is replaced (the dispatcher of a unit test).
for_dispatcher
fn for_dispatcher(dispatcher: &Arc<Dispatcher>) -> Rc<Self>
The scheduler of dispatcher, created once per dispatcher: instance
for its own dispatcher, otherwise one scheduler per dispatcher at
DispatcherPriority::BACKGROUND (For(Dispatcher)).
dispatcher
fn dispatcher(self: &Self) -> &Arc<Dispatcher>
The dispatcher the scheduler runs its work on (Dispatcher).
priority
fn priority(self: &Self) -> DispatcherPriority
The priority of the drains and of the timers of delayed work (Priority).
check_access
fn check_access(self: &Self) -> bool
Whether the calling thread is the thread of the dispatcher, which may run the work of the
scheduler inline (CheckAccess).
install_on_ui_thread
fn install_on_ui_thread()
Makes the synchronization context of the dispatcher of the user-interface thread the
synchronization context of that thread (SynchronizationContext.SetSynchronizationContext),
which also makes it the thread poster of the thread
(ferroui_system::task::set_thread_schedule): a task of the user-interface
thread woken from another thread is resumed through the dispatcher.
The context is the dispatcher's FerroSynchronizationContext of the thread (installed if it
has none yet), at DispatcherPriority::NORMAL when the thread has none. Nothing changes
when that context is already the current one.
Deprecated: a dispatcher is the schedule of its thread from its start, so the wakes from
other threads reach it without this, and the dispatcher at the priority of the running job
is the current schedule of ferroui-system (ferroui_system::task::current_schedule),
which the tasks and the reactive libraries read. The code that runs outside of a job takes
the priority that Dispatcher::set_current_priority sets, which the application sets to
Normal.
Panics
Panics when the calling thread is not the user-interface thread.
Deprecated since 0.5.0. the dispatcher is the schedule of its thread and of its jobs (
ferroui_system::task::current_schedule); nothing is to be installed
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyClassDefaultsErasedDestructorIntoEitherDebugISchedulerIThreadAffineSequencer
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.