Environment: Siren
An instance of EventScheduler is a simple driver for real-time message-passing among any classes that can return timed event association values. One uses Schedules by setting up clients which a master scheduler process continuously evaluates for their next timed activations. Clients can return appointments which are sorted into the scheduler's list of (time -> event) associations that is evaluated continuously when running. Changed messages are sent from the accessor messages to simplify EventScheduler browsers and inspectors.
Instance variables:
Class variable:
See the class examples.
accessing
clients
appointments
running
doWait
scheduling--set to false if there is a lower level of scheduling
(e.g., primitive-level) or if output need not be real-time
startTime
Schedule
addClient: theApp at: start
Add the argument, 'theApp', to the instance variable 'appointments'.
addClient: theApp at: start loop: aBool
Add the argument, 'theApp', to the instance variable 'appointments'.
addClient: theApp in: start
Add the argument, 'theApp', to the instance variable 'appointments'.
addClient: theApp in: start loop: loopBool
Add the argument, 'theApp', to the instance variable 'appointments'.
addClient: theApp loop: aBool
Add the argument, 'theApp', to the instance variable 'appointments'.
addTimer: start
Add the argument, 'theApp', to the instance variable 'timers'.
addTimer: start interval: int
Add the argument, 'theApp', to the instance variable 'timers'.
clientNamed: aName
Answer a named client
clients
Get the instance's clients
clock
Answer the instance's clock (in usec)
delay
Get the instance's delay
delay: aTime
Set the instance's delay
dontWait
Specify that the scheduler should NOT do the waiting--i.e., there is a lower level of scheduling going on
isRunning
Answer the instance variable 'running'.
removeClient: aClient
Add the argument, 'theApp', to the instance variable 'timers'.
removeClientNamed: aClient
Add the argument, 'theApp', to the instance variable 'timers'.
removeTimer: aTimer
Add the argument, 'theApp', to the instance variable 'timers'.
removeTimerNamed: aTimer
Add the argument, 'theApp', to the instance variable 'timers'.
resetClock
Reset the instances clock (in usec)
timerNamed: aName
Answer a named timer
timers
Answer the instance's timers
wait
Specify that the scheduler should do the waiting--i.e., Smalltalk-level real-time.
updating
Check if clients are waiting
running
Calls upon the next appointment to be made and then reschedules the next one
flush
Reset the appointment list.
interrupt
Stop a running scheduler.
processEvent: entry at: now
Handle an event or timer
run
Set up the first meetings and then run them all till no one wants a meeting anymore.
run: theBool
Accept the argument, 'theBool', as the instance variable 'running'.
initialize release
Set up the default Schedule
release
Clean up the schedule.
MetaClass: EventScheduler class
examples
Play MIDI using the event scheduler.
scheduleExample2
Play MIDI using the event scheduler.
timerExample
Start some timers in the event scheduler.
class initialization
Set up the global Scheduler.
release
Clear away the global EventScheduler.
instance control
Add a timer to the instance
addClient: aT at: theTime
Add a timer to the instance
addClient: aT in: theTime
Add a timer to the instance
addClient: aT in: theTime loop: loopBool
Add a timer to the instance
addTimer: aT
Add a timer to the instance
addTimer: aT interval: int
Add a timer to the instance
clients
Get the instance's clients
clock
Answer the instance's clock
flush
Reset all running schedules by brute force.
interrupt
Stop all running schedules by brute force.
isRunning
Ask the instance if it's on
resetClock
Answer the instance's clock
run
Turn the instance on
timers
Get the instance's timers
instance creation
EventScheduler instance
instance
EventScheduler instance