


MSGWAIT(3)            iPSC(Reg.)/860 System            MSGWAIT(3)



NAME
     MSGWAIT - Wait for an asynchronous send or receive operation
     to complete.

SYNOPSIS
     msgwait(_i_d)

     long _i_d;

ENVIRONMENT
     Host, Node

DESCRIPTION OF PARAMETERS
     _i_d        The non-negative message ID returned by isend() or
               irecv()

DISCUSSION
     Use msgwait() to cause a node process to wait until the
     isend() or irecv() operation identified by _i_d completes.
     When msgwait() returns:

     o+ The buffer contains valid data (if _i_d identifies a receive
       operation; use the info...() calls to get more information
       about the message), or the buffer is available for reuse
       (if _i_d identifies a send operation).

     o+ The message ID number that identifies the asynchronous
       send or receive (_i_d) _i_s released for use in a future
       asynchronous send or receive.

                                 NOTE

          The number of message IDs is limited, and an error
          occurs when no message IDs are available for a
          requested asynchronous send or receive. Therefore, your
          program should release the message ID as soon as
          possible by calling msgwait(), msgdone(), or
          msgcancel().

EXAMPLE

       long iam;

       main() {

       long msgid;
       char smsg[80], rmsg[80];

          iam = mynode();
          sprintf(smsg,"Hello from node %d\n",iam);
          msgid = irecv(100, rmsg, sizeof(rmsg));




Release 3.3.2        Last change: 3/17/1992                     1






MSGWAIT(3)            iPSC(Reg.)/860 System            MSGWAIT(3)



          csend(100, smsg,     strlen(smsg)+1 ,-1,0);

          msgwait(msgid);

          printf("%d: received: %s\n",iam,rmsg);
       }

ERRORS
msgwait: Invalid message id

     Use message ID returned by irecv() or isend(). Also, make
     sure that the message ID has not been released by a previous
     msgcancel() or msgdone() call.

msgwait: Received message too long

     Make sure the buffer is large enough for buffer to hold the
     message.

msgwait: No pid defined

     Use setpid() in the host program to define a host process
     ID.

SEE ALSO
     infocount(), infonode(), infopid(), infotype(), irecv(),
     isend(), msgcancel(), msgdone()

























Release 3.3.2        Last change: 3/17/1992                     2






