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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Jul  2 19:02:36 2014 +0200

copperplate/threadobj: fix periodic mode setup

---

 lib/copperplate/threadobj.c |   21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index 881b3ce..888120f 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -1436,25 +1436,10 @@ int threadobj_set_periodic(struct threadobj *thobj,
                        return __bt(-errno);
        }
 
-       if (period == NULL) {
-               /* Maybe a oneshot specification. */
-               its.it_interval.tv_sec = 0;
-               its.it_interval.tv_nsec = 0;
-       } else
-               its.it_interval = *period;
-
-       if (idate == NULL) {
-               /* Maybe a start now or stop specification. */
-               its.it_value.tv_sec = 0;
-               its.it_value.tv_nsec = 0;
-               ret = __RT(timer_settime(thobj->periodic_timer, 0,
-                                        &its, NULL));
-       } else {
-               its.it_value = *idate;
-               ret = __RT(timer_settime(thobj->periodic_timer, TIMER_ABSTIME,
-                                        &its, NULL));
-       }
+       timespec_add(&its.it_value, idate, period);
+       its.it_interval = *period;
 
+       ret = __RT(timer_settime(thobj->periodic_timer, TIMER_ABSTIME, &its, 
NULL));
        if (ret)
                return __bt(-errno);
 


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

Reply via email to