Difference between revisions of "Buffered"
m |
m (6 revisions imported) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
== Example == | == Example == | ||
− | var a:Int::allocated[single[on[1]]]; | + | function void main() { |
− | + | var a:Int::allocated[single[on[1]]]; | |
− | + | var b:Int::allocated[single[on[2]]] :: buffered[500]; | |
− | + | var c:Int::allocated[single[on[2]]] :: buffered[500] :: nonblocking[]; | |
− | + | a:=b; | |
+ | a:=c; | ||
+ | }; | ||
The P2P communication resulting from assignment ''a:=b'', process 2 will issue a (blocking) buffered send (buffer size 500 bytes), which will complete once the message has been copied into this buffer. The assignment ''a:=c'', process 1 will issue another send this time also buffered but nonblocking where program flow will continue between the start and finish state of communication. The finish state will be reached once the value of variable ''c'' has been copied into a buffer held on process 2. | The P2P communication resulting from assignment ''a:=b'', process 2 will issue a (blocking) buffered send (buffer size 500 bytes), which will complete once the message has been copied into this buffer. The assignment ''a:=c'', process 1 will issue another send this time also buffered but nonblocking where program flow will continue between the start and finish state of communication. The finish state will be reached once the value of variable ''c'' has been copied into a buffer held on process 2. | ||
− | ''Since: Version 0. | + | ''Since: Version 0.5'' |
[[Category:Type Library]] | [[Category:Type Library]] | ||
[[Category:Compound Types]] | [[Category:Compound Types]] | ||
[[Category:Communication Mode Types]] | [[Category:Communication Mode Types]] |
Latest revision as of 15:44, 15 April 2019
Syntax
buffered[buffersize]
Semantics
This type will ensure that P2P Send will reach the finish state (i.e. complete) when the message is copied into a buffer of size buffersize bytes. At some later point the message will be sent to the target process. If buffersize is not provided then a default is used. This type associates with the sync keyword which will wait until the message has been copied out of the buffer.
Example
function void main() { var a:Int::allocated[single[on[1]]]; var b:Int::allocated[single[on[2]]] :: buffered[500]; var c:Int::allocated[single[on[2]]] :: buffered[500] :: nonblocking[]; a:=b; a:=c; };
The P2P communication resulting from assignment a:=b, process 2 will issue a (blocking) buffered send (buffer size 500 bytes), which will complete once the message has been copied into this buffer. The assignment a:=c, process 1 will issue another send this time also buffered but nonblocking where program flow will continue between the start and finish state of communication. The finish state will be reached once the value of variable c has been copied into a buffer held on process 2.
Since: Version 0.5