Checkpoint synchronization: Difference between revisions

Content added Content deleted
Line 1,430: Line 1,430:
func: checkPoint(n, jobs, channels)
func: checkPoint(n, jobs, channels)
{
{
| i ch |
while(true) [
while(true) [
#[ jobs receive drop ] times(n)
n loop: i [ jobs receive drop ]
"CHECKPOINT : All jobs done, sending done to all tasks" println
"CHECKPOINT : All jobs done, sending done to all tasks" println
channels apply(#[ send($done) drop ]
channels forEach: ch [ $done ch send drop ]
]
]
}
}
Line 1,441: Line 1,442:
| jobs channels i |
| jobs channels i |
n seq map(#[ drop Channel new]) ->channels
n seq map(#[ drop Channel new]) ->channels
Channel newSize(n) ->jobs
Channel new ->jobs


#[ checkPoint(n, jobs, channels) ] &
#[ checkPoint(n, jobs, channels) ] &
n loop: i [ #[ task(i, jobs, channels at(i)) ] & ]
n loop: i [ #[ task(i, jobs, channels at(i)) ] & ]
}
}</lang>
</lang>


=={{header|Perl}}==
=={{header|Perl}}==