Skip to content

Commit a173881

Browse files
kernel: spinlock: update k_spin_lock() documentation wrt context switch
Threads must not attempt to context switch if they are holding a spinlock. Add this information to the documentation for k_spin_lock(). Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
1 parent d741733 commit a173881

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/zephyr/spinlock.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ static ALWAYS_INLINE void z_spinlock_validate_post(struct k_spinlock *l)
175175
* in uniprocessor contexts such that the locking reduces to an
176176
* interrupt mask operation.
177177
*
178+
* @warning
179+
* Holding a spinlock when a context switch occurs is illegal.
180+
*
178181
* @param l A pointer to the spinlock to lock
179182
* @return A key value that must be passed to k_spin_unlock() when the
180183
* lock is released.

0 commit comments

Comments
 (0)