mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
binfmt: add enter_critical_section
adding enter_critical_section to ensure non preemption in smp Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -77,6 +77,7 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
|
|||||||
FAR const posix_spawnattr_t *attr)
|
FAR const posix_spawnattr_t *attr)
|
||||||
{
|
{
|
||||||
FAR struct binary_s *bin;
|
FAR struct binary_s *bin;
|
||||||
|
irqstate_t flags;
|
||||||
int pid;
|
int pid;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -126,6 +127,7 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
|
|||||||
* handler.
|
* handler.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
sched_lock();
|
sched_lock();
|
||||||
|
|
||||||
/* Then start the module */
|
/* Then start the module */
|
||||||
@@ -160,10 +162,12 @@ int exec_spawn(FAR const char *filename, FAR char * const *argv,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
leave_critical_section(flags);
|
||||||
return pid;
|
return pid;
|
||||||
|
|
||||||
errout_with_lock:
|
errout_with_lock:
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
|
leave_critical_section(flags);
|
||||||
unload_module(bin);
|
unload_module(bin);
|
||||||
errout_with_bin:
|
errout_with_bin:
|
||||||
kmm_free(bin);
|
kmm_free(bin);
|
||||||
|
|||||||
Reference in New Issue
Block a user