cb_mux provides utilities for storing, retrieving, and managing callback information in a singly linked list.
More...
cb_mux provides utilities for storing, retrieving, and managing callback information in a singly linked list.
If an API provides the ability to call multiple callbacks, cb_mux can simplify handling of an arbitrary number of callbacks by requiring memory for a cb_mux entry to be passed along with other arguments. The cb_mux entry is then attached to a list using cb_mux_add. The code implementing that API can manage the list using the various utility functions that cb_mux provides.
◆ cb_mux_add()
Add a new entry to the end of a cb_mux list.
- Parameters
-
[in] | head | double pointer to first list entry |
[in] | entry | entry to add |
◆ cb_mux_del()
Remove a entry from a cb_mux list.
- Parameters
-
[in] | head | double pointer to first list entry |
[in] | entry | entry to remove |
◆ cb_mux_find_cbid()
Find an entry in the list by ID.
- Parameters
-
[in] | head | pointer to first list entry |
[in] | cbid_val | ID to find |
- Returns
- pointer to the list entry
◆ cb_mux_find_free_id()
Find the lowest unused ID.
Returns highest possible ID on failure
- Parameters
-
[in] | head | pointer to first list entry |
- Returns
- lowest unused ID
◆ cb_mux_find_high()
Find the entry with the highest ID.
If there are multiple hits, this returns the oldest.
- Parameters
-
[in] | head | pointer to first list entry |
- Returns
- pointer to the list entry
◆ cb_mux_find_low()
Find the entry with the lowest ID.
If there are multiple hits, this returns the oldest.
- Parameters
-
[in] | head | pointer to first list entry |
- Returns
- pointer to the list entry
◆ cb_mux_iter()
Run a function on every item in the cb_mux list.
- Parameters
-
[in] | head | pointer to first list entry |
[in] | func | function to run on each entry |
[in] | arg | argument for the function |