NAME

mr_send - send a message to a thread

SYNOPSIS

#include <mrendez.h>

pthread_t mr_send( void *request , void * response,
pthread_t pthread_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 request is a pointer to a message to be sent to the thread identified by pthread_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 response.

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 request and response 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 pthread_id is the id 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 response argument.

ERRORS

EBADID
The calling thread has attempted to send to a pthread_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()




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