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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Apr 28 10:52:18 2014 +0200

copperplate/threadobj: constify timespec args in API

---

 include/copperplate/threadobj.h |    8 +++++---
 lib/copperplate/threadobj.c     |   14 ++++++++------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h
index 0ad24c3..754de3d 100644
--- a/include/copperplate/threadobj.h
+++ b/include/copperplate/threadobj.h
@@ -325,10 +325,12 @@ int threadobj_set_priority(struct threadobj *thobj, int 
prio);
 
 int threadobj_set_mode(int clrmask, int setmask, int *mode_r);
 
-int threadobj_set_rr(struct threadobj *thobj, struct timespec *quantum);
+int threadobj_set_rr(struct threadobj *thobj,
+                    const struct timespec *quantum);
 
 int threadobj_set_periodic(struct threadobj *thobj,
-                          struct timespec *idate, struct timespec *period);
+                          const struct timespec *__restrict__ idate,
+                          const struct timespec *__restrict__ period);
 
 int threadobj_wait_period(unsigned long *overruns_r);
 
@@ -337,7 +339,7 @@ void threadobj_spin(ticks_t ns);
 int threadobj_stat(struct threadobj *thobj,
                   struct threadobj_stat *stat);
 
-int threadobj_sleep(struct timespec *ts);
+int threadobj_sleep(const struct timespec *ts);
 
 #ifdef CONFIG_XENO_PSHARED
 
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index 96694b0..9a4cf0b 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -304,7 +304,7 @@ int threadobj_set_mode(int clrmask, int setmask, int 
*mode_r) /* current->lock h
        return 0;
 }
 
-static int set_rr(struct threadobj *thobj, struct timespec *quantum)
+static int set_rr(struct threadobj *thobj, const struct timespec *quantum)
 {
        struct sched_param_ex xparam;
        pthread_t tid = thobj->tid;
@@ -332,7 +332,8 @@ static int set_rr(struct threadobj *thobj, struct timespec 
*quantum)
 }
 
 int threadobj_set_periodic(struct threadobj *thobj,
-                          struct timespec *idate, struct timespec *period)
+                          const struct timespec *__restrict__ idate,
+                          const struct timespec *__restrict__ period)
 {
        return -pthread_make_periodic_np(thobj->tid,
                                         CLOCK_COPPERPLATE, idate, period);
@@ -678,7 +679,7 @@ int threadobj_set_mode(int clrmask, int setmask, int 
*mode_r) /* current->lock h
        return __bt(ret);
 }
 
-static inline int set_rr(struct threadobj *thobj, struct timespec *quantum)
+static int set_rr(struct threadobj *thobj, const struct timespec *quantum)
 {
        pthread_t tid = thobj->tid;
        struct sched_param param;
@@ -731,7 +732,8 @@ static inline int set_rr(struct threadobj *thobj, struct 
timespec *quantum)
 }
 
 int threadobj_set_periodic(struct threadobj *thobj,
-                          struct timespec *idate, struct timespec *period)
+                          const struct timespec *__restrict__ idate,
+                          const struct timespec *__restrict__ period)
 {
        struct timespec now, wakeup;
 
@@ -1256,7 +1258,7 @@ int threadobj_unblock(struct threadobj *thobj) /* 
thobj->lock held */
        return __bt(-__RT(pthread_kill(thobj->tid, SIGRELS)));
 }
 
-int threadobj_sleep(struct timespec *ts)
+int threadobj_sleep(const struct timespec *ts)
 {
        struct threadobj *current = threadobj_current();
        sigset_t set;
@@ -1301,7 +1303,7 @@ void threadobj_spin(ticks_t ns)
                cpu_relax();
 }
 
-int threadobj_set_rr(struct threadobj *thobj, struct timespec *quantum)
+int threadobj_set_rr(struct threadobj *thobj, const struct timespec *quantum)
 {                              /* thobj->lock held */
        __threadobj_check_locked(thobj);
 


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

Reply via email to