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

Author: Tom Philips <tom.philips1...@gmail.com>
Date:   Wed Jun 12 19:08:26 2013 +0200

psos: fix timeout handling in sm_p() (SM_NOWAIT)

---

 lib/psos/sem.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/psos/sem.c b/lib/psos/sem.c
index 616bd02..24865d6 100644
--- a/lib/psos/sem.c
+++ b/lib/psos/sem.c
@@ -172,7 +172,7 @@ u_long sm_ident(const char *name, u_long node, u_long 
*smid_r)
 
 u_long sm_p(u_long smid, u_long flags, u_long timeout)
 {
-       struct timespec ts, *timespec;
+       struct timespec ts, *timespec = &ts;
        struct psos_sem *sem;
        struct service svc;
        int ret;
@@ -183,10 +183,12 @@ u_long sm_p(u_long smid, u_long flags, u_long timeout)
 
        COPPERPLATE_PROTECT(svc);
 
-       if (timeout != 0) {
-               timespec = &ts;
+       if (flags & SM_NOWAIT) {
+               timespec->tv_sec = 0;
+               timespec->tv_nsec = 0;
+       } else if (timeout != 0)
                clockobj_ticks_to_timeout(&psos_clock, timeout, timespec);
-       } else
+       else
                timespec = NULL;
 
        ret = semobj_wait(&sem->smobj, timespec);


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

Reply via email to