Module: xenomai-forge
Branch: master
Commit: 94b956551f69a90b1071ef3ed75ab3fed6f5bc17
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=94b956551f69a90b1071ef3ed75ab3fed6f5bc17

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Jan 29 15:38:52 2012 +0100

posix: get pthread_mutex_trylock to use dedicated syscall

---

 lib/cobalt/mutex.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/lib/cobalt/mutex.c b/lib/cobalt/mutex.c
index 70684ad..f4c5a03 100644
--- a/lib/cobalt/mutex.c
+++ b/lib/cobalt/mutex.c
@@ -233,7 +233,6 @@ int __wrap_pthread_mutex_trylock(pthread_mutex_t *mutex)
        struct __shadow_mutex *_mutex =
                &((union __xeno_mutex *)mutex)->shadow_mutex;
        unsigned long status;
-       struct timespec ts;
        xnhandle_t cur;
        int err;
 
@@ -271,21 +270,15 @@ int __wrap_pthread_mutex_trylock(pthread_mutex_t *mutex)
 
 do_syscall:
 
-       __RT(clock_gettime(CLOCK_REALTIME, &ts));
        do {
-               err = XENOMAI_SKINCALL2(__cobalt_muxid,
-                                       sc_cobalt_mutex_timedlock, _mutex, &ts);
+               err = XENOMAI_SKINCALL1(__cobalt_muxid,
+                                       sc_cobalt_mutex_trylock, _mutex);
        } while (err == -EINTR);
 
-       if (err) {
-               if (err == -ETIMEDOUT || err == -EDEADLK)
-                       return EBUSY;
-               return -err;
-       }
-
-       _mutex->lockcnt = 1;
+       if (!err)
+               _mutex->lockcnt = 1;
 
-       return 0;
+       return -err;
 }
 
 int __wrap_pthread_mutex_unlock(pthread_mutex_t *mutex)


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

Reply via email to