diff --git a/sched/sched/sched_waitid.c b/sched/sched/sched_waitid.c index 3b119d3143b..0c8c895b14e 100644 --- a/sched/sched/sched_waitid.c +++ b/sched/sched/sched_waitid.c @@ -152,11 +152,11 @@ int nx_waitid(int idtype, id_t id, FAR siginfo_t *info, int options) #ifdef CONFIG_SMP irqstate_t flags = enter_critical_section(); -#endif - +#else /* Disable pre-emption so that nothing changes while the loop executes */ sched_lock(); +#endif /* Verify that this task actually has children and that the requested * TCB is actually a child of this task. @@ -417,10 +417,11 @@ int nx_waitid(int idtype, id_t id, FAR siginfo_t *info, int options) } errout: - sched_unlock(); #ifdef CONFIG_SMP leave_critical_section(flags); +#else + sched_unlock(); #endif return ret; diff --git a/sched/sched/sched_waitpid.c b/sched/sched/sched_waitpid.c index 40534b6c819..d787ca01f95 100644 --- a/sched/sched/sched_waitpid.c +++ b/sched/sched/sched_waitpid.c @@ -78,11 +78,11 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options) #ifdef CONFIG_SMP irqstate_t flags = enter_critical_section(); -#endif - +#else /* Disable pre-emption so that nothing changes in the following tests */ sched_lock(); +#endif /* Get the TCB corresponding to this PID */ @@ -169,10 +169,11 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options) ret = pid; errout: - sched_unlock(); #ifdef CONFIG_SMP leave_critical_section(flags); +#else + sched_unlock(); #endif return ret; @@ -217,11 +218,11 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options) #ifdef CONFIG_SMP irqstate_t flags = enter_critical_section(); -#endif - +#else /* Disable pre-emption so that nothing changes while the loop executes */ sched_lock(); +#endif /* Verify that this task actually has children and that the requested PID * is actually a child of this task. @@ -464,10 +465,11 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options) ret = pid; errout: - sched_unlock(); #ifdef CONFIG_SMP leave_critical_section(flags); +#else + sched_unlock(); #endif return ret;