mirror of
https://github.com/apache/nuttx.git
synced 2026-09-07 17:36:38 +00:00
sched_smp:adjust the unlock order
1.nxsem_post wake up nxsched_smp_call; 2.stack smp_call_data_s may return; 3.nxsched_smp_call_handler access call_data->lock is not safety; so adjust the unlock order Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
This commit is contained in:
parent
e0d9cc432c
commit
755bef6c56
1 changed files with 8 additions and 8 deletions
|
|
@ -137,6 +137,14 @@ int nxsched_smp_call_handler(int irq, FAR void *context,
|
|||
ret = call_data->func(call_data->arg);
|
||||
|
||||
flags = enter_critical_section();
|
||||
if (spin_is_locked(&call_data->lock))
|
||||
{
|
||||
if (--call_data->refcount == 0)
|
||||
{
|
||||
spin_unlock(&call_data->lock);
|
||||
}
|
||||
}
|
||||
|
||||
if (call_data->cookie != NULL)
|
||||
{
|
||||
if (ret < 0)
|
||||
|
|
@ -146,14 +154,6 @@ int nxsched_smp_call_handler(int irq, FAR void *context,
|
|||
|
||||
nxsem_post(&call_data->cookie->sem);
|
||||
}
|
||||
|
||||
if (spin_is_locked(&call_data->lock))
|
||||
{
|
||||
if (--call_data->refcount == 0)
|
||||
{
|
||||
spin_unlock(&call_data->lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
up_cpu_paused_restore();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue