In-memory list of data logging sessions, sorted by session ID.
More...
In-memory list of data logging sessions, sorted by session ID.
The list is protected by a recursive mutex. Each active session also has its own mutex, taken with dls_lock_session().
◆ DlsListCallback
Callback for dls_list_for_each_session().
Called with the list mutex held, with the session and the user data. Returns false to stop iterating.
◆ dls_assert_own_list_mutex()
| void dls_assert_own_list_mutex |
( |
void |
| ) |
|
Assert that the current task owns the list mutex.
◆ dls_get_session_status()
Get the status of a session.
- Parameters
-
- Returns
- Session status.
◆ dls_list_add_new_session()
Assign a new random unique ID to a session and add it to the list.
- Parameters
-
| logging_session | Session to add. |
- Returns
- Assigned session ID.
◆ dls_list_create_session()
◆ dls_list_find_active_session()
Find the active session with a given tag and owner.
- Parameters
-
| tag | Session tag. |
| app_uuid | Owner UUID. |
- Returns
- Session, or NULL if not found.
◆ dls_list_find_by_session_id()
Find a session by ID.
- Parameters
-
- Returns
- Session, or NULL if not found.
◆ dls_list_for_each_session()
Call a callback for each session, with the list mutex held.
- Parameters
-
| cb | Callback. |
| data | User data passed to cb. |
- Returns
- false if
cb stopped the iteration, true otherwise.
◆ dls_list_get_next()
Iterate over the session list.
- Parameters
-
| cur | Current session, or NULL to get the first one. |
- Returns
- Next session, or NULL at the end of the list.
◆ dls_list_init()
| void dls_list_init |
( |
void |
| ) |
|
Initialize the session list.
◆ dls_list_insert_session()
Add a session that already has an ID.
Used at boot when restoring sessions from flash.
- Parameters
-
| logging_session | Session to add. |
◆ dls_list_is_session_valid()
Check whether a pointer refers to a session in the list.
Safe to call with arbitrary pointers: only compares against the known sessions.
- Parameters
-
| logging_session | Pointer to check. |
- Returns
- true if
logging_session is in the list.
◆ dls_list_lock()
| void dls_list_lock |
( |
void |
| ) |
|
Lock the list mutex (recursive).
◆ dls_list_remove_all()
| void dls_list_remove_all |
( |
void |
| ) |
|
Free all sessions in memory without touching flash.
◆ dls_list_remove_session()
Remove a session from the list and free it.
- Parameters
-
| logging_session | Session to remove. |
◆ dls_list_unlock()
| void dls_list_unlock |
( |
void |
| ) |
|
Unlock the list mutex (recursive).
◆ dls_lock_session()
Lock an active session.
Must not be called with the list mutex held.
- Parameters
-
- Returns
- true if the session was active and is now locked, false if it is inactive.
◆ dls_unlock_session()
Unlock a session locked with dls_lock_session().
- Parameters
-
| session | Session to unlock. |
| inactivate | Inactivate the session, and free its active state, once its last lock is released. |