.PVM.nrecv {rpvm}R Documentation

Nonblocking receive

Description

Checks for nonblocking message.

Usage

.PVM.nrecv (tid = -1, msgtag = -1)

Arguments

tid tid of sending process (-1 matches any tid)
msgtag integer message tag (>=0) supplied by the user (-1 matches any message tag)

Details

.PVM.nrecv checks to see whether a message with lable msgtag has arrived from tid. If a matching message has arrived, it then immediately places the message in a new active receive buffer, which also clears the current receive buffer, if any, and returns the buffer id.

If the requested message has not arrived, then .PVM.nrecv immediately returns 0.

A -1 in tid or msgtag matches anything. Later .PVM.bufinfo can be used to find out the tid of the sending process or msgtag.

.PVM.nrecv is nonblocking in the sense that the routing always returns immediately either with the message or with the information that the message has not arrived at the local pvmd yet. .PVM.nrecv can be called multiple times to check whether a given message has arrived yet.

If .PVM.nrecv returns with the message, the data in the message can be unpacked with the PVM.unpack functions.

Value

Returns the id of the new active receive buffer. -1 indicates an error.

Author(s)

Na (Michael) Li nali@umn.edu and A.J. Rossini rossini@u.washington.edu

References

PVM documentation

See Also

.PVM.send, .PVM.recv, .PVM.bufinfo, PVM.unpack

Examples

## Not run: myparent <- .PVM.parent ()
## Not run: 
while (1) {
    bufid <- .PVM.nrecv (myparent, 4)
    if (bufid > 0) {
        data <- .PVM.upkintvec ()
        # do something ...
        break
    } else {
        # do something else
    }
}
## End(Not run)

[Package rpvm version 0.6-2 Index]