Movie::Scheduler
Centralized scheduler for managing timers within the actor system. Provides cancellable one-shot timers that execute callbacks after a delay. Uses the actor system's dispatcher for proper fiber management.
Example:
handle = scheduler.schedule_once(5.seconds) do
puts "Timer fired!"
end
handle.cancel # Cancels the timer if not yet fired
Constructors
Instance methods
Schedules a one-shot timer that sends a message to an actor after the given delay. Returns a TimerHandle that can be used to cancel the timer.
Schedules a one-shot timer that executes the block after the given delay. Returns a TimerHandle that can be used to cancel the timer before it fires.
If the timer is cancelled before the delay expires, the block will not be executed. If the timer has already fired, cancellation has no effect.
Schedules a one-shot timer that sends a system message to an actor after the given delay. Returns a TimerHandle that can be used to cancel the timer.