Changes

Jump to: navigation, search

GPU621/The Chapel Programming Language

124 bytes added, 15:36, 2 December 2020
Task Parallelism
** '''''writeEF()''''' - it will block until variable's statement is ''empty'', then set the argument value.
** '''''readFF()''''' - it will block until variable's statement is ''full'', then read the value and return the '''value'''. sync and single variable cannot directly output, use this method to output the value.
** '''''readXX()''''' - return the '''truevalue''' regardless variable's statement.
* For sync variables only:
** '''''reset()''''' - set the value to its type's default value and set statement to '''empty'''.
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 taskthread");
begin {
var sy getNewsy = sy$; // This statement will block until sy$ is full writeln("In new taskchild thread, sy=", sygetNewsy);
done$ = true;
}
writeln("Task Thread created"); var result = done$.readXX(); writeln("Thread finished? ", result);
sy$ = getSy;
var result = writeln("Thread finished? ", done$; writeln.readFE(result));
=== Locality ===
25
edits

Navigation menu