vfs:add nxsched_foreach to sched_lock avoid crash
If scheduling occurs in file_fsync, fl_lock may be released, and an error may occur when calling nxmutex_unlock Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
fa63ef69c9
commit
48c153db25
@ -63,6 +63,7 @@ void nxsched_foreach(nxsched_foreach_t handler, FAR void *arg)
|
||||
/* Visit each active task */
|
||||
|
||||
flags = enter_critical_section();
|
||||
sched_lock();
|
||||
for (ndx = 0; ndx < g_npidhash; ndx++)
|
||||
{
|
||||
/* This test and the function call must be atomic */
|
||||
@ -73,5 +74,6 @@ void nxsched_foreach(nxsched_foreach_t handler, FAR void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user