feat(freertos): introduce thread-safe context management functions

This commit is contained in:
wuzhenghui
2026-06-03 17:51:34 +08:00
parent e389f3e4df
commit 90f6eeb327
13 changed files with 214 additions and 5 deletions

View File

@@ -382,6 +382,19 @@ In IDF FreeRTOS, the process of a particular core entering and exiting a critica
#. The core releases the spinlock by clearing the spinlock's owner value.
#. The core re-enables interrupts or interrupt nesting.
Thread-Safe Port Critical Bypass
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``xPortThreadSafeClaim()`` and ``xPortThreadSafeDisclaim()`` (``portmacro.h``) skip port-layer critical enter/exit on the current core. **Thread safety between Claim and Disclaim must be guaranteed by the caller.**
.. warning::
- Caller guarantees thread safety for the ClaimDisclaim window (all cores).
- Claim only with interrupts disabled on the current core; one active claim system-wide; pair with Disclaim on every path.
- ``pdPASS`` from ``xPortEnterCriticalTimeout()`` does not mean ``mux`` was taken.
Not a substitute for ``taskENTER_CRITICAL(&spinlock)``.
Restrictions and Considerations
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^