Core Low Level
This has the Core Low Level APIs.
API reference
Header File
Classes
-
class ScopedChipStackLock
RAII-style scoped lock for the Matter (CHIP) stack.
This class provides automatic locking and unlocking of the Matter stack using the RAII (Resource Acquisition Is Initialization) pattern. The lock is acquired when the object is constructed and automatically released when it goes out of scope.
Use this class whenever you need to access Matter stack APIs from a non-Matter context (e.g., from application tasks, callbacks, or interrupt handlers). The Matter stack is single-threaded and requires synchronization when accessed from external contexts.
Advantages
Exception Safety: The lock is automatically released even if an exception occurs or the function returns early, preventing deadlocks.
Simplified Code: No need to manually call lock/unlock functions or worry about missing unlock calls in error paths.
Scope-based Lifetime: The lock duration is clearly defined by the variable’s scope, making the code easier to read and maintain.
Copy Prevention: The class is non-copyable to prevent accidental lock duplication which could lead to undefined behavior.
Note
Always use the smallest possible scope for the lock to minimize blocking time.