All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Fix rt_task_shadow error path without __thread.
@ 2009-04-02  9:14 Gilles Chanteperdrix
  2009-04-02 16:52 ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2009-04-02  9:14 UTC (permalink / raw)
  To: xenomai-core


Hi,

it seems that rt_task_shadow currently leaves the self tsd assigned (and
uninitialized) in case of error. So, here is an attempt to fix this
situation:

Index: src/skins/native/task.c
===================================================================
--- src/skins/native/task.c     (revision 4727)
+++ src/skins/native/task.c     (working copy)
@@ -187,15 +187,8 @@

 #ifdef HAVE___THREAD
        self = &__native_self;
-#else /* !HAVE___THREAD */
-       self = pthread_getspecific(__native_tskey);
+#endif /* HAVE___THREAD */

-       if (!self)
-               self = malloc(sizeof(*self));
-
-       pthread_setspecific(__native_tskey, self);
-#endif /* !HAVE___THREAD */
-
        if (task == NULL)
                task = &task_desc; /* Discarded. */

@@ -217,9 +210,13 @@
                                NULL);

        if (!err) {
-               if (self)
-                       *self = *task;
+#ifndef HAVE___THREAD
+               self = malloc(sizeof(*self));

+               pthread_setspecific(__native_tskey, self);
+#endif /* !HAVE___THREAD */
+               *self = *task;
+
                xeno_set_current();

                if (mode & T_WARNSW)


-- 
                                                 Gilles.


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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-02  9:14 [Xenomai-core] Fix rt_task_shadow error path without __thread Gilles Chanteperdrix
2009-04-02 16:52 ` Jan Kiszka
2009-04-03 14:22   ` Gilles Chanteperdrix
2009-04-03 16:34     ` 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.