Module: xenomai-3 Branch: stable-3.0.x Commit: 6357ba65908215001d09e868a36ef68edcc3540f URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=6357ba65908215001d09e868a36ef68edcc3540f
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 http://xenomai.org/mailman/listinfo/xenomai-git