Module: xenomai-3
Branch: wip/dovetail
Commit: 05cb8fa1c0fee230c3c3a4e8a85833ca6a5ac883
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=05cb8fa1c0fee230c3c3a4e8a85833ca6a5ac883

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Feb 17 18:42:49 2016 +0100

lib/cobalt/thread: fix unwanted relax spot in pthread_create()

---

 lib/cobalt/thread.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c
index abb0b41..aab2c81 100644
--- a/lib/cobalt/thread.c
+++ b/lib/cobalt/thread.c
@@ -225,8 +225,10 @@ int pthread_create_ex(pthread_t *ptid_r,
        __STD(sem_init(&iargs.sync, 0, 0));
 
        ret = __STD(pthread_create(&lptid, &attr, cobalt_thread_trampoline, 
&iargs));
-       if (ret)
-               goto out;
+       if (ret) {
+               __STD(sem_destroy(&iargs.sync));
+               return ret;
+       }
 
        __STD(clock_gettime(CLOCK_REALTIME, &timeout));
        timeout.tv_sec += 5;
@@ -249,10 +251,10 @@ int pthread_create_ex(pthread_t *ptid_r,
                panic("regular sem_wait() failed with %s", symerror(ret));
        }
 
-       cobalt_thread_harden(); /* May fail if regular thread. */
-out:
        __STD(sem_destroy(&iargs.sync));
 
+       cobalt_thread_harden(); /* May fail if regular thread. */
+
        return ret;
 }
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to