Nonblocking

From Mesham
Jump to navigationJump to search

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