The following function sends a data packet from a side to another side.
This function sends a data packet occupying sz bytes and addressed by msgp from a side side_from to a side side_to.
The function appends the data packet to the end of the queue of received data packets of side_to.
If another thread called the function
qsmm_side_recv for side_to and is waiting for a data packet to receive, the thread resumes execution, and that function returns the data packet just received.
On success, the function returns a non-negative value.
If there was not enough memory to perform the operation, the function returns negative error code
The following function receives a data packet.
This function retrieves a data packet from the queue of received data packets of side and stores the data packet in a buffer msgp with size sz bytes. If sz is greater than the size of this data packet, the function leaves the remaining content of msgp unchanged. If there is no data packet to retrieve, the function blocks until another thread sends a data packet to side.
On success, the function returns a non-negative number of bytes occupied by a retrieved data packet or
INT_MAX if this number is greater than
If sz is less than the size of the data packet in the queue, or if sz is positive, and msgp is
NULL, the function returns negative error code
Use the following macro to send a data packet from a side to another side.
This macro sends a data packet stored in a variable msg from a side from to a side to. The macro expands to:
qsmm_side_send((from), (to), sizeof(msg), &(msg))
The macro argument msg must be a variable and not a constant, as the macro takes the address of that argument using ‘&’.
For example, to send signal 1 from a side
side_from to a side
side_to, use lines of code like these:
const qsmm_sig_t sig_out=1; QSMM_SIDE_SEND(side_from,side_to,sig_out);
Use the following macro to receive a data packet.
This macro retrieves a data packet from the queue of received data packets of side and stores the data packet in a variable *msgp. The macro expands to:
qsmm_side_recv((side), sizeof(*(msgp)), (msgp))
For example, to receive a signal sent to a side, use lines of code like these:
qsmm_sig_t sig_in=QSMM_SIG_INVALID; QSMM_SIDE_RECV(side,&sig_in);