cthreadcomm · Section 3
ceventloop_reg_count
NAME
ceventloop_reg_count - number of currently-registered ceventloop_reg handles
LIBRARY
C Collections (libccollections, -lccollections)
SYNOPSIS
#include <ccollections/cthreadcomm.h> size_t ceventloop_reg_count(ceventloop loop);
DESCRIPTION
Returns the number of live registrations, meaning ceventloop_add() calls whose registration has not been removed yet. It does not count entries in the epoll interest list, so one fd registered for both directions counts as 2: Two independent ceventloop_reg handles stand behind it, even though they share one entry.
PARAMETERS
loop ceventloop to query.
RETURN VALUE
The number of registrations, or (size_t)-1 when loop is CEVENTLOOP_NULL, a stale handle, or a handle that has already been destroyed.
THREAD SAFETY
Safe to call at the same time as ceventloop_add(), ceventloop_remove() and a dispatch on any reactor thread. The value is a consistent snapshot read with a single atomic load, which cannot tear, and no lock is taken.