## NAME

mr_send - send a message to a thread

## SYNOPSIS

#include <mrendez.h>

pthread_t mr_send( void *rqst , void * rply,
  pthread_t id , int port ,
  struct timespec *timeout );

## DESCRIPTION

The primitive mr_send() is used to send a message to a thread which is expected to perform an mr_receive(). The argument rqst is a pointer to a message to be sent to the thread identified by id. The port argument specifies the port on the receiver's end through which the message is to be routed. Note that the sending thread blocks until a reply message is received.

When the receiver performs a mr_reply(), it can pass back data in rply.

Currently, the value of timeout must be FOREVER, which indicates that the sender is willing to block until the mr_reply() is forthcoming.

The first two bytes (16 bits) of the rqst and rply argument are taken to be the total size, in bytes, of the appropriate message. The lesser of this size and the size obtained from the receiver's messages represents the number of bytes actually copied by the system.

## RETURN VALUES

A positive value for id is the identifier of the thread which received the message. A value of 0 indicates an error. The receiver may return data to the caller in the area pointed to by the rply argument.

## ERRORS

EBADID
  The calling thread has attempted to send to a id which does not represent a thread in the system.
EBADPORT
  The calling thread has attempted to route the message to a port number which exceeds the number of ports specified for the receiver.

## SEE ALSO

mr_receive(), mr_reply()

#### Home page (Kernel)

## < Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2018 >