From a6e8ab1d51bd648e2c3353f71184eaa33f67d299 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 26 Aug 2012 22:00:38 +0000 Subject: [PATCH] waitpid(): Move some logic inside of a critical section git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5054 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 2 ++ sched/sched_waitpid.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4135bd19ae..cb7f4079df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3183,3 +3183,5 @@ Fix some strange (and probably wrong) list handling when CONFIG_PRIORITY_INHERITANCE and CONFIG_SEM_PREALLOCHOLDERS are defined. 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) diff --git a/sched/sched_waitpid.c b/sched/sched_waitpid.c index e8e2f61a23..692ef64102 100644 --- a/sched/sched_waitpid.c +++ b/sched/sched_waitpid.c @@ -178,7 +178,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) { - _TCB *tcb = sched_gettcb(pid); + _TCB *tcb; bool mystat; int err; 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 */ sched_lock(); + tcb = sched_gettcb(pid); if (!tcb) { err = ECHILD;