Add comment explaining HolderFromISR/SMP TOCTOU

On SMP systems, xSemaphoreGetMutexHolderFromISR()
is particularly difficult to use - note the footgun.

See also espressif/esp-idf#18913
This commit is contained in:
Richard Allen 2026-09-04 10:29:58 -05:00
parent 8be86d4a24
commit 8db1d0d1a3

View file

@ -1157,6 +1157,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* If xMutex is not a mutex type semaphore, or the mutex is available (not held
* by a task), return NULL.
*
* Note: On SMP systems, the return value may be invalidated by other core(s).
*/
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
#define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) )