All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] libnative: Avoid double-evaluation of rt_task_self()
@ 2009-04-02 19:36 Jan Kiszka
  2009-04-02 21:40 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2009-04-02 19:36 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai-core

[-- Attachment #1: Type: text/plain, Size: 903 bytes --]

[ can be pulled from git.xenomai.org/xenomai-jki.git queues/assorted ]

Keep the result of rt_task_self() in a local variable to avoid the
second invocation.

Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---

 src/skins/native/task.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/skins/native/task.c b/src/skins/native/task.c
index 905d366..149717b 100644
--- a/src/skins/native/task.c
+++ b/src/skins/native/task.c
@@ -247,10 +247,11 @@ int rt_task_resume(RT_TASK *task)
 
 int rt_task_delete(RT_TASK *task)
 {
+	RT_TASK *self;
 	int err;
 
 	if (task == NULL ||
-	    (rt_task_self() && task->opaque == rt_task_self()->opaque)) {
+	    ((self = rt_task_self()) && self->opaque == task->opaque)) {
 		/* Silently migrate to avoid raising SIGXCPU. */
 		XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_LINUX_DOMAIN);
 		pthread_exit(NULL);


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-04-13 16:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-02 19:36 [Xenomai-core] [PATCH] libnative: Avoid double-evaluation of rt_task_self() Jan Kiszka
2009-04-02 21:40 ` Gilles Chanteperdrix
2009-04-02 21:45   ` Philippe Gerum
2009-04-04  7:37     ` Jan Kiszka
2009-04-04  9:18       ` Philippe Gerum
2009-04-13 16:13         ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.