* [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
* Re: [Xenomai-core] [PATCH] libnative: Avoid double-evaluation of rt_task_self()
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
0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2009-04-02 21:40 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai-core
Jan Kiszka wrote:
> [ 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.
Maybe we could create a pure/const variant of rt_task_self() for use in
task.c only which would avoid the double evaluatino ?
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-core] [PATCH] libnative: Avoid double-evaluation of rt_task_self()
2009-04-02 21:40 ` Gilles Chanteperdrix
@ 2009-04-02 21:45 ` Philippe Gerum
2009-04-04 7:37 ` Jan Kiszka
0 siblings, 1 reply; 6+ messages in thread
From: Philippe Gerum @ 2009-04-02 21:45 UTC (permalink / raw)
To: Gilles Chanteperdrix; +Cc: Jan Kiszka, xenomai-core
On Thu, 2009-04-02 at 23:40 +0200, Gilles Chanteperdrix wrote:
> Jan Kiszka wrote:
> > [ 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.
>
> Maybe we could create a pure/const variant of rt_task_self() for use in
> task.c only which would avoid the double evaluatino ?
>
Can't do const because of pthread_getspecific(), but pure attribute is t
hand, yes.
--
Philippe.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-core] [PATCH] libnative: Avoid double-evaluation of rt_task_self()
2009-04-02 21:45 ` Philippe Gerum
@ 2009-04-04 7:37 ` Jan Kiszka
2009-04-04 9:18 ` Philippe Gerum
0 siblings, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2009-04-04 7:37 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai-core
[-- Attachment #1: Type: text/plain, Size: 674 bytes --]
Philippe Gerum wrote:
> On Thu, 2009-04-02 at 23:40 +0200, Gilles Chanteperdrix wrote:
>> Jan Kiszka wrote:
>>> [ 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.
>> Maybe we could create a pure/const variant of rt_task_self() for use in
>> task.c only which would avoid the double evaluatino ?
>>
>
> Can't do const because of pthread_getspecific(), but pure attribute is t
> hand, yes.
>
At least my gcc 4.3 ignores
RT_TASK *rt_task_self(void) __attribute__ ((pure));
and keeps on inserting two calls in rt_task_delete.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-core] [PATCH] libnative: Avoid double-evaluation of rt_task_self()
2009-04-04 7:37 ` Jan Kiszka
@ 2009-04-04 9:18 ` Philippe Gerum
2009-04-13 16:13 ` Jan Kiszka
0 siblings, 1 reply; 6+ messages in thread
From: Philippe Gerum @ 2009-04-04 9:18 UTC (permalink / raw)
To: Jan Kiszka; +Cc: xenomai-core
On Sat, 2009-04-04 at 09:37 +0200, Jan Kiszka wrote:
> Philippe Gerum wrote:
> > On Thu, 2009-04-02 at 23:40 +0200, Gilles Chanteperdrix wrote:
> >> Jan Kiszka wrote:
> >>> [ 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.
> >> Maybe we could create a pure/const variant of rt_task_self() for use in
> >> task.c only which would avoid the double evaluatino ?
> >>
> >
> > Can't do const because of pthread_getspecific(), but pure attribute is t
> > hand, yes.
> >
>
> At least my gcc 4.3 ignores
>
> RT_TASK *rt_task_self(void) __attribute__ ((pure));
>
We can't do that on rt_task_self() directly, because of
rt_task_shadow().
> and keeps on inserting two calls in rt_task_delete.
>
What if a pure static inline helper is used internally from task.c?
> Jan
>
--
Philippe.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-core] [PATCH] libnative: Avoid double-evaluation of rt_task_self()
2009-04-04 9:18 ` Philippe Gerum
@ 2009-04-13 16:13 ` Jan Kiszka
0 siblings, 0 replies; 6+ messages in thread
From: Jan Kiszka @ 2009-04-13 16:13 UTC (permalink / raw)
To: Philippe Gerum; +Cc: xenomai-core
[-- Attachment #1: Type: text/plain, Size: 1464 bytes --]
Philippe Gerum wrote:
> On Sat, 2009-04-04 at 09:37 +0200, Jan Kiszka wrote:
>> Philippe Gerum wrote:
>>> On Thu, 2009-04-02 at 23:40 +0200, Gilles Chanteperdrix wrote:
>>>> Jan Kiszka wrote:
>>>>> [ 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.
>>>> Maybe we could create a pure/const variant of rt_task_self() for use in
>>>> task.c only which would avoid the double evaluatino ?
>>>>
>>> Can't do const because of pthread_getspecific(), but pure attribute is t
>>> hand, yes.
>>>
>> At least my gcc 4.3 ignores
>>
>> RT_TASK *rt_task_self(void) __attribute__ ((pure));
>>
>
> We can't do that on rt_task_self() directly, because of
> rt_task_shadow().
>
>> and keeps on inserting two calls in rt_task_delete.
>>
>
> What if a pure static inline helper is used internally from task.c?
>
Makes no difference (and defining a new helper for this purpose would be
overkill anyway).
So please pull my original version from
git://git.xenomai.org/xenomai-jki.git for-upstream
BTW, you'll find another trivial fix in that queue:
--- a/src/testsuite/switchtest/switchtest.c
+++ b/src/testsuite/switchtest/switchtest.c
@@ -1094,7 +1094,7 @@ int check_fpu(void)
exit(EXIT_FAILURE);
}
- return (int) status;
+ return (long) status;
}
int main(int argc, const char *argv[])
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]
^ permalink raw reply [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.