


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



NAME
     ISEND - Send a message asynchronously.

SYNOPSIS
     #include <cube.h>

     long isend(_t_y_p_e, _b_u_f, _l_e_n, _n_o_d_e, _p_i_d)

     long _t_y_p_e;
     char *_b_u_f;
     long _l_e_n, _n_o_d_e, _p_i_d;

RETURN VALUE
     A non-negative message ID for use in msgcancel(), msgdone(),
     or msgwait() system calls

                                 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().

ENVIRONMENT
     Host, Node

DESCRIPTION OF PARAMETERS
     _t_y_p_e      The type of the message being sent. Refer to
               Appendix A of the _i_P_S_C(_R_e_g.)/_8_6_0 _C _S_y_s_t_e_m _C_a_l_l_s
               _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l for information on selecting
               message types.

     _b_u_f       Pointer to the buffer that contains the message
               being sent. The buffer may be of any legal data
               type, but should match the data type of the buffer
               in the corresponding receive operation.

     _l_e_n       The size (in bytes) of the message. Message size
               is limited only by the memory available for the
               buffer. If _l_e_n is greater than the maximum message
               length, an error message will be issued.

     _n_o_d_e      The ID of the node(s) to whom the message is being
               sent. Setting _n_o_d_e to -1 sends the message to all
               nodes except the sending node. Nodes within a cube
               are numbered consecutively from 0.

     _p_i_d       The ID of the process to whom the message is being
               sent. (Always 0; other values ignored.)




Release 3.3.2        Last change: 3/17/1992                     1






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



DISCUSSION
     Use isend() to send a message asynchronously. The isend()
     system call returns a message ID that you can use with the
     msgdone() and msgwait() system calls to determine when the
     send completes (and the buffer can be reused).

     Completion of isend() does not imply that the message was
     received by the destination process, only that the message
     was sent and that the message buffer is available for reuse.

     This is an asynchronous call. The calling process continues
     to run while the send is being done. To send a message and
     block the calling process until the send completes, use
     csend() (a synchronous call) instead of isend().

EXAMPLE

       #include <cube.h>

       void display();

       #define INIT_TYPE 10

       long iam;

       main()
       {
       long msgid;
       char msgbuf[80], smsg[80];

          iam = mynode();
          display("Starting ...\n");
          if(!iam) {
             sprintf(smsg,"Hello from node %d\n",iam);
             msgid = isend(INIT_TYPE, smsg, sizeof(smsg), 1, 0);
             printf("Node %d sent: %s",iam,smsg);
             msgwait(msgid);
             printf("Node %d send buffer available for writing\n",iam);
          }
          else {
                crecv(INIT_TYPE, msgbuf, sizeof(msgbuf));
                printf("Node %d received: %s\n",iam,msgbuf);
          }
       }

       void display(dmsg)
       char *dmsg;
       {
          if(!iam) printf("\n%s",dmsg);
       }





Release 3.3.2        Last change: 3/17/1992                     2






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



ERRORS
isend: Invalid type

     Use a non-negative number.

isend: Invalid length

     Use a non-negative number or a length less than or equal to
     maximum message length.

isend: Invalid node

     Use numnodes() to determine cube size.

isend: Buffer length exceeds allocation

     Make sure parameter length does not exceed buffer size.

isend: Invalid buffer pointer

     Specify a pointer that contains the address of a valid data
     buffer.

isend: Not enough memory

     Make sure message buffer starts on a boundary that is a
     multiple of four, or make more memory available to this
     process.

isend: Too many requests

     Use msgwait() or msgdone() for outstanding isend() or
     irecv() requests.

csendrecv: No pid defined

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

SEE ALSO
     crecv(), csend(), irecv(), isendrecv(), msgcancel(),
     msgdone(), msgwait()










Release 3.3.2        Last change: 3/17/1992                     3






