Changes

Jump to: navigation, search

GPU621/The Chapel Programming Language

95 bytes removed, 18:27, 2 December 2020
Task Parallelism
'''cobeign:''' it creates a block of tasks. The main thread will continue until the statements inside are finished.
'''coforall:''' it is a loop of cobegin syntax in which each iteration is a separate task. The main thread will also continue until the loop is finished. The order of execution within each iteration is determined, and the order of iteration will execute first is not determined.
An example code:
An example code:
var sy$: sync int = 2; // state = full, value = 2 var getSy = sy$; // sy$: state = empty
writeln("Default value: ", getSy);
var done$: sync bool;
writeln("Create thread");
begin {
var getNewsy = sy$; // This statement will block until sy$ is full
writeln("In child thread, sy=", getNewsy);
done$ = true;
25
edits

Navigation menu