riot_sys

Function gnrc_netreg_num

Source
pub unsafe extern "C" fn gnrc_netreg_num(
    type_: gnrc_nettype_t,
    demux_ctx: u32,
) -> c_int
Expand description

@brief Returns number of entries with the same gnrc_netreg_entry_t::type and gnrc_netreg_entry_t::demux_ctx.

@param[in] type Type of the protocol. @param[in] demux_ctx The demultiplexing context for the registered thread. See gnrc_netreg_entry_t::demux_ctx.

@return Number of entries with the same gnrc_netreg_entry_t::type and gnrc_netreg_entry_t::demux_ctx as the given parameters.

Note that this returns a snapshot value, which may change at any time after that call. This is fine for most applications, as they just shortcut a code path if the number is zero. Callers that need that number to stay constant can acquire a shared lock through @ref gnrc_netreg_acquire_shared, and rely on the number staying constant until that lock is released through @ref gnrc_netreg_release_shared.