a0NewPort()

Creates a new port.


Syntax

a0tError a0NewPort(
a0tPort *port,
int tags,
int type);

Arguments

Namerd/wrDescription
port write Port created.
tags read Number of tags that can be used with the port.
type read local or global creation.

Description

This function creates a port descriptor, to be used on any site of the computation. If type is A0LocalCreation, then the created port is only created in the local node. If type is A0GlobalCreation, then all nodes must do the call to a0NewPort() at same time and all nodes will create the same port descriptor.

In other words, when a node calls a0NewPort() with type==A0LocalCreation, a port descriptor is returned that it is guaranteed not to be returned by in any other, subsequent or concurrent, call to a0NewPort(), on any node. (Actually, it can return the same port number of a previous call, when a0DisposePort() has been called to free a port descriptor). When the call to a0NewPort() is made with type==A0GlobalCreation, it is supposed to happen in all nodes at the same time. All the calls on all the nodes will return the same port descriptor. All nodes must do global creations of ports in the same order.

tags gives the number of tags associated with that port. Valid values for a tag to use with that port are in the range 0 to tags$-1$. The implementation of ports with more than one tag is done by allocating consecutive ports and returning the number of the first one. In a communication, the tag is added to the first port number.


Return Values

If an error condition occurs, it returns the error code, otherwise it returns A0ErrOk. Possible values are as follows:
Error CodeDescription
A0Err...Some error occurred.
A0ErrOkSuccessful completion.

See Also

a0DisposePort() a0Send() a0SendBuffer() a0Receive() a0ReceiveBuffer()