Difference between revisions of "Nonblocking"
From Mesham
Jump to navigationJump to search (Created page with '== Syntax == nonblocking[ ] == Semantics == This type will force P2P communication to be nonblocking. In this mode communication (send or receive) can be thought of as having …') |
m (5 revisions imported) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
== Example == | == Example == | ||
− | var a:Int::allocated[single[on[1]]] :: nonblocking[]; | + | function void main() { |
− | + | var a:Int::allocated[single[on[1]]] :: nonblocking[]; | |
− | + | var b:Int::allocated[single[on[2]]]; | |
− | + | a:=b; | |
+ | sync a; | ||
+ | }; | ||
In the P2P communication resulting from assignment ''a:=b'', process 1 will issue a non-blocking receive whilst process 2 will issue a blocking send. All nonblocking communication with respect to variable ''a'' is completed by the keyword ''sync a''. | In the P2P communication resulting from assignment ''a:=b'', process 1 will issue a non-blocking receive whilst process 2 will issue a blocking send. All nonblocking communication with respect to variable ''a'' is completed by the keyword ''sync a''. | ||
+ | ''Since: Version 0.5'' | ||
[[Category:Type Library]] | [[Category:Type Library]] | ||
− | [[Category: | + | [[Category:Compound Types]] |
[[Category:Communication Mode Types]] | [[Category:Communication Mode Types]] |
Latest revision as of 15:44, 15 April 2019
Syntax
nonblocking[ ]
Semantics
This type will force P2P communication to be nonblocking. In this mode communication (send or receive) can be thought of as having two distinct states - start and finish. The nonblocking type will start communication and allows program execution to continue between these two states, whilst blocking (standard) mode requires the finish state has been reached before continuing. The sync keyword can be used to force the program to wait until finish state has been reached.
Example
function void main() { var a:Int::allocated[single[on[1]]] :: nonblocking[]; var b:Int::allocated[single[on[2]]]; a:=b; sync a; };
In the P2P communication resulting from assignment a:=b, process 1 will issue a non-blocking receive whilst process 2 will issue a blocking send. All nonblocking communication with respect to variable a is completed by the keyword sync a.
Since: Version 0.5