cthreadcomm · Section 3
ccircq_send
NAME
ccircq_send - send a message to the queue (it blocks)
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cthreadcomm.h> ccol_retval ccircq_send(ccircq *cq, cmessage *msg);
DESCRIPTION
Waits until the queue has free space and then puts the message in it. The data is not copied: Its ownership moves to the queue, and on success msg->data is set to NULL.
PARAMETERS
cq Circular queue to send to
msg Message to send. On success the ownership of the data moves to the
queue.
RETURN VALUE
ccol_success - The message was sent
ccol_invalid_args - cq or msg is NULL, msg->data is NULL while
msg->size is not 0, or msg->data is not NULL
while msg->size is 0
ccol_not_permitted - Sends on the queue are turned off
NOTES
The wait for free space has no time limit, but it ends when sends on the queue are turned off, because a woken sender checks the send state again before it goes on. On failure the caller keeps the ownership of msg->data. msg->data == NULL with msg->size == 0 is valid and works as a sentinel message. msg->data == NULL with msg->size > 0 is refused, and so is msg->data != NULL with msg->size == 0, because a live pointer must carry a payload.