Events: Difference between revisions

Content added Content deleted
(Initial FutureBasic task solution added)
m (→‎{{header|Wren}}: Changed to Wren S/H)
Line 1,256: Line 1,256:


The tasks to be executed are added to a list by the Scheduler class. The Timer.sleep method suspends the current fiber and signals the scheduler (by calling a private method) to execute the tasks one by one in their own fibers - in Wren only one fiber can execute at a time. The task results are then available to the main fiber on its resumption after Timer.sleep has completed.
The tasks to be executed are added to a list by the Scheduler class. The Timer.sleep method suspends the current fiber and signals the scheduler (by calling a private method) to execute the tasks one by one in their own fibers - in Wren only one fiber can execute at a time. The task results are then available to the main fiber on its resumption after Timer.sleep has completed.
<syntaxhighlight lang="ecmascript">import "scheduler" for Scheduler
<syntaxhighlight lang="wren">import "scheduler" for Scheduler
import "timer" for Timer
import "timer" for Timer


Line 1,279: Line 1,279:
10
10
</pre>
</pre>



=={{header|Yabasic}}==
=={{header|Yabasic}}==