On Feb 24, 2011, at 8:49 46PM, laurent laffont wrote:

> Finally a funny class ;)
> 
> I rephrase a little:
> 
> I represent a message sent to be scheduled by the SMxWorldState. I'm the 
> exact duplicate of MorphicAlarm in the Simple Morphic world (see MorphicAlarm 
> comment).
> 
> 
> And in MorphicAlarm:
> 
> I represent a message to be scheduled by the WorldState.
> 
> For example, you can see me in action with the following example which print 
> 'alarm test' on Transcript one second after evaluating the code:
> 
> Transcript open.
> MorphicUIManager currentWorld
>       addAlarm: #show: 
>       withArguments: #('alarm test') 
>       for: Transcript 
>       at: (Time millisecondClockValue + 1000).
> 
> 
> 
> I haven't been able to test the previous code in SimpleMorphic, there's a MNU 
> when trying to write in the Workspace.
> 
> 
> Laurent
> 

For those wondering "why not just use normal delays and  threading system?", 
you might want to add:
"Compared to doing:
[(Delay forMilliseconds: 1000) wait. Transcript show: 'alarm test'] forkAt: 
Processor activeProcess priority +1.

the alarm system has 2 distinctions:
- Runs with the step refresh rate resolution.
- Alarms only run for the active world. (Unless a non-standard scheduler is in 
use)
- Alarms with the same scheduled time are guaranteed to be executed in the 
order they were added"

At least that's what I could reckon.

Cheers,
Henry



Reply via email to