You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/06/15 13:17:21 UTC
[incubator-nuttx] branch master updated: sched: Make
task_delete(getpid()) equal exit(EXIT_SUCCESS)
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new f70981c sched: Make task_delete(getpid()) equal exit(EXIT_SUCCESS)
f70981c is described below
commit f70981c1797a2ba0389849441c196be7b64db611
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Jun 7 04:31:20 2020 +0800
sched: Make task_delete(getpid()) equal exit(EXIT_SUCCESS)
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
Change-Id: I63b2a372ccf0e9ac4e6a7fc9b1b160d71eeeb40f
---
sched/task/task_delete.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/sched/task/task_delete.c b/sched/task/task_delete.c
index e212386..8a6fe5b 100644
--- a/sched/task/task_delete.c
+++ b/sched/task/task_delete.c
@@ -132,6 +132,17 @@ int task_delete(pid_t pid)
goto errout;
}
+ /* Check if the task to delete is the calling task */
+
+ if (pid == rtcb->pid)
+ {
+ /* If it is, then what we really wanted to do was exit. Note that we
+ * don't bother to unlock the TCB since it will be going away.
+ */
+
+ exit(EXIT_SUCCESS);
+ }
+
/* Check to see if this task has the non-cancelable bit set in its
* flags. Suppress context changes for a bit so that the flags are stable.
* (the flags should not change in interrupt handling).
@@ -183,17 +194,7 @@ int task_delete(pid_t pid)
}
#endif
- /* Check if the task to delete is the calling task */
-
sched_unlock();
- if (pid == rtcb->pid)
- {
- /* If it is, then what we really wanted to do was exit. Note that we
- * don't bother to unlock the TCB since it will be going away.
- */
-
- exit(EXIT_SUCCESS);
- }
/* Otherwise, perform the asynchronous cancellation, letting
* nxtask_terminate() do all of the heavy lifting.