cthreadcomm · Section 3
cchan_msg_count
NAME
cchan_msg_count - get the current message count of a direction
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cthreadcomm.h> size_t cchan_msg_count(cchan *ch, cchan_direction d);
DESCRIPTION
Returns how many messages the queue of the given direction holds at the moment of the call.
PARAMETERS
ch Channel to ask
d Direction to ask about (cchan_owner_to_workers or
cchan_workers_to_owner)
RETURN VALUE
The number of messages in that direction, or (size_t)-1 when the cchan is NULL or the direction is not valid.
NOTES
Reading the count is thread-safe, but it is only a snapshot: Other threads can change it as soon as the call returns.