C Collections

cthreadcomm · Section 3

ceventloop_reg_count

ceventloop_reg_count - number of currently-registered ceventloop_reg handles

C Collections (libccollections, -lccollections)

#include <ccollections/cthreadcomm.h>
 
size_t ceventloop_reg_count(ceventloop loop);

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.

loop  ceventloop to query.

The number of registrations, or (size_t)-1 when loop is
CEVENTLOOP_NULL, a stale handle, or a handle that has already
been destroyed.

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.

ceventloop_add(3), ceventloop_remove(3)