C Collections

cthreadcomm · Section 3

cchan_try_send

cchan_try_send - try to send a message with no block

C Collections (libccollections, -lccollections)

#include <ccollections/cthreadcomm.h>
 
ccol_retval cchan_try_send(cchan *ch, cmessage *msg);

Puts the message into the queue that the channel picks for the calling
thread if there is room, and returns at once when that queue is full.

ch   Channel to send through
msg  Message to send. On success the ownership of the data moves to the
     channel.

ccol_success         - The message was sent
ccol_invalid_args    - ch 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 chosen direction are turned off
ccol_container_full  - The chosen queue is full

This call never blocks. The direction comes from the ID of the
calling thread, as described in cchan_send(3).

cchan_send(3), cchan_timed_send(3)