forked from Archive/PX4-Autopilot
waitpid(): Move some logic inside of a critical section
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5054 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
fe493d8bb8
commit
61fccacd85
|
@ -3183,3 +3183,5 @@
|
||||||
Fix some strange (and probably wrong) list handling when
|
Fix some strange (and probably wrong) list handling when
|
||||||
CONFIG_PRIORITY_INHERITANCE and CONFIG_SEM_PREALLOCHOLDERS are defined.
|
CONFIG_PRIORITY_INHERITANCE and CONFIG_SEM_PREALLOCHOLDERS are defined.
|
||||||
This list handling was probably causing errors reported by Mike Smith
|
This list handling was probably causing errors reported by Mike Smith
|
||||||
|
* sched/sched_waitpid.c: Fix a possible issue with logic logic that
|
||||||
|
should be brought into a critical section (suggested by Mike Smith)
|
||||||
|
|
|
@ -178,7 +178,7 @@
|
||||||
|
|
||||||
pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
||||||
{
|
{
|
||||||
_TCB *tcb = sched_gettcb(pid);
|
_TCB *tcb;
|
||||||
bool mystat;
|
bool mystat;
|
||||||
int err;
|
int err;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -186,6 +186,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
|
||||||
/* Disable pre-emption so that nothing changes in the following tests */
|
/* Disable pre-emption so that nothing changes in the following tests */
|
||||||
|
|
||||||
sched_lock();
|
sched_lock();
|
||||||
|
tcb = sched_gettcb(pid);
|
||||||
if (!tcb)
|
if (!tcb)
|
||||||
{
|
{
|
||||||
err = ECHILD;
|
err = ECHILD;
|
||||||
|
|
Loading…
Reference in New Issue