Module: xenomai-gch
Branch: for-2.4
Commit: fb8fc1074ff2dc3da884f45ad888ecfbd5528f90
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=fb8fc1074ff2dc3da884f45ad888ecfbd5528f90

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Fri Dec  4 23:58:38 2009 +0100

posix: fix __wrap_pthread_cond_wait for better handling of signals and error 
conditions

---

 src/skins/posix/cond.c |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/skins/posix/cond.c b/src/skins/posix/cond.c
index 26f1779..c3f1dd5 100644
--- a/src/skins/posix/cond.c
+++ b/src/skins/posix/cond.c
@@ -87,12 +87,15 @@ struct pse51_cond_cleanup_t {
 static void __pthread_cond_cleanup(void *data)
 {
        struct pse51_cond_cleanup_t *c = (struct pse51_cond_cleanup_t *) data;
+       int err;
 
-       XENOMAI_SKINCALL3(__pse51_muxid,
-                         __pse51_cond_wait_epilogue,
-                         &c->cond->shadow_cond,
-                         &c->mutex->shadow_mutex,
-                         c->count);
+       do {
+               err = -XENOMAI_SKINCALL3(__pse51_muxid,
+                                        __pse51_cond_wait_epilogue,
+                                        &c->cond->shadow_cond,
+                                        &c->mutex->shadow_mutex,
+                                        c->count);
+       } while (err == EINTR);
 }
 
 int __wrap_pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex)
@@ -121,11 +124,17 @@ int __wrap_pthread_cond_wait(pthread_cond_t * cond, 
pthread_mutex_t * mutex)
        if (err)
                return err;
 
-       __pthread_cond_cleanup(&c);
+       do {
+               err = -XENOMAI_SKINCALL3(__pse51_muxid,
+                                        __pse51_cond_wait_epilogue,
+                                        &c.cond->shadow_cond,
+                                        &c.mutex->shadow_mutex,
+                                        c.count);
+       } while (err == EINTR);
 
        pthread_testcancel();
 
-       return 0;
+       return err;
 }
 
 int __wrap_pthread_cond_timedwait(pthread_cond_t * cond,
@@ -156,7 +165,13 @@ int __wrap_pthread_cond_timedwait(pthread_cond_t * cond,
        if (err && err != ETIMEDOUT)
                return err;
 
-       __pthread_cond_cleanup(&c);
+       do {
+               err = -XENOMAI_SKINCALL3(__pse51_muxid,
+                                        __pse51_cond_wait_epilogue,
+                                        &c.cond->shadow_cond,
+                                        &c.mutex->shadow_mutex,
+                                        c.count);
+       } while (err == EINTR);
 
        pthread_testcancel();
 


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

Reply via email to