C Collections

cthreadcomm · Section 3

cchan_msg_count

cchan_msg_count - get the current message count of a direction

C Collections (libccollections, -lccollections)

#include <ccollections/cthreadcomm.h>
 
size_t cchan_msg_count(cchan *ch, cchan_direction d);

Returns how many messages the queue of the given direction holds at
the moment of the call.

ch   Channel to ask
d    Direction to ask about (cchan_owner_to_workers or
     cchan_workers_to_owner)

The number of messages in that direction, or (size_t)-1 when the
cchan is NULL or the direction is not valid.

Reading the count is thread-safe, but it is only a snapshot: Other
threads can change it as soon as the call returns.

cchan_send(3), cchan_recv(3)