Checkpoint synchronization: Difference between revisions

m
Line 1,472:
=={{header|Oforth}}==
Checkpoint is implemented as a task. It :
 
- Receives n "jobDone" events from n tasks into a "jobs" channel.
 
- Then sends $allDone event to all tasks so they can work again.
 
Each task :
 
- Sleeps randomly between 1 and 1000 milliseconds, simulating its job.
 
- Then sends "jobDone" to the checkpoint using "jobs" channel.
 
- And waits for $allDone checkpoint return on its personal channel.
 
Line 1,498 ⟶ 1,503:
: testCheckPoint(n)
| jobs channels i |
nListBuffer seq mapinit(n, #[ drop Channel new ]) dup freeze ->channels
Channel new ->jobs
 
1,015

edits