Difference between revisions of "Broadcast"
From Mesham
Jump to navigationJump to searchm |
m (5 revisions imported) |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 9: | Line 9: | ||
== Example == | == Example == | ||
| − | var a:Int::allocated[multiple[]]; | + | function void main() { |
| − | + | var a:Int::allocated[multiple[]]; | |
| − | + | var p; | |
| − | + | par p from 0 to 3 { | |
| + | (a::broadcast[2]):=23; | ||
| + | }; | ||
}; | }; | ||
In this example process 2 (the root) will broadcast the value 23 amongst the processes, each process receiving this value and placing it into their copy of ''a''. | In this example process 2 (the root) will broadcast the value 23 amongst the processes, each process receiving this value and placing it into their copy of ''a''. | ||
| + | |||
| + | ''Since: Version 0.41b'' | ||
[[Category:Type Library]] | [[Category:Type Library]] | ||
[[Category:Compound Types]] | [[Category:Compound Types]] | ||
[[Category:Primitive Communication Types]] | [[Category:Primitive Communication Types]] | ||
Latest revision as of 15:44, 15 April 2019
Syntax
broadcast[root]
Semantics
This type will broadcast a variable amongst the processes, with the root (source) being PID=root. The variable concerned must either be allocated to all or a group of processes (in the later case communication will be limited to that group.)
Example
function void main() {
var a:Int::allocated[multiple[]];
var p;
par p from 0 to 3 {
(a::broadcast[2]):=23;
};
};
In this example process 2 (the root) will broadcast the value 23 amongst the processes, each process receiving this value and placing it into their copy of a.
Since: Version 0.41b