Skip to content
Commit e2f05e93 authored by Qi Yang's avatar Qi Yang Committed by Christopher Friedt
Browse files

kernel: mutex: fix races when lock timeout



Say threadA holds a mutex and threadB tries
to lock it with a timeout, a race would occur
if threadA unlock that mutex after threadB
got unpended by sys_clock and before it gets
scheduled and calls k_spin_lock.

This patch fixes this issue by checking the
mutex's status again after k_spin_lock calls.

Fixes #48056

Signed-off-by: default avatarQi Yang <qi.yang@cmind-semi.com>
(cherry picked from commit 89c4a074)
parent ea0b53b1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment