mirror of
https://github.com/apache/nuttx.git
synced 2026-10-07 14:25:25 +00:00
sched/pthread: use spin_lock_irqsave_nopreempt for mutex head lock
Replace spin_lock_irqsave with spin_lock_irqsave_nopreempt in pthread_mutex_inconsistent to prevent preemption during mutex list manipulation and avoid potential deadlocks or race conditions. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
f7dc54e869
commit
bc3d478749
1 changed files with 2 additions and 2 deletions
|
|
@ -372,7 +372,7 @@ void pthread_mutex_inconsistent(FAR struct tcb_s *tcb)
|
|||
|
||||
DEBUGASSERT(tcb != NULL);
|
||||
|
||||
flags = spin_lock_irqsave(&tcb->mhead_lock);
|
||||
flags = spin_lock_irqsave_nopreempt(&tcb->mhead_lock);
|
||||
|
||||
/* Remove and process each mutex held by this task */
|
||||
|
||||
|
|
@ -390,5 +390,5 @@ void pthread_mutex_inconsistent(FAR struct tcb_s *tcb)
|
|||
mutex_unlock(&mutex->mutex);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&tcb->mhead_lock, flags);
|
||||
spin_unlock_irqrestore_nopreempt(&tcb->mhead_lock, flags);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue