Module: xenomai-3
Branch: stable-3.0.x
Commit: c93977f5152d22200d69f8503420f79c10c052c4
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=c93977f5152d22200d69f8503420f79c10c052c4

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Sep 15 12:25:03 2017 +0200

copperplate/clockobj: map CLOCK_COPPERPLATE over CLOCK_MONOTONIC

nptl's pthread_condattr_setclock() routine does not accept
CLOCK_MONOTONIC_RAW, but only CLOCK_REALTIME or CLOCK_MONOTONIC.

For this reason, any API (e.g. libalchemy) would fail trying to set
condvar clocks to CLOCK_COPPERPLATE if --enable-clock-monotonic-raw
was passed to the configure script, as we originally mapped
CLOCK_COPPERPLATE over CLOCK_MONOTONIC_RAW in this case.

Since only Mercury might be affected by NTP adjustments to
CLOCK_MONOTONIC, not Cobalt, simply map CLOCK_COPPERPLATE over
CLOCK_MONOTONIC, as a general fix to the issue.

---

 include/copperplate/clockobj.h |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/include/copperplate/clockobj.h b/include/copperplate/clockobj.h
index 2807d69..633cfe8 100644
--- a/include/copperplate/clockobj.h
+++ b/include/copperplate/clockobj.h
@@ -28,9 +28,8 @@
 #include <copperplate/debug.h>
 
 /*
- * We normally define the Copperplate clock as a monotonic,
- * non-adjustable one, unless the threading library has restrictions
- * to support this over Mercury.
+ * The Copperplate clock shall be monotonic unless the threading
+ * library has restrictions to support this over Mercury.
  *
  * In the normal case, this means that ongoing delays and timeouts
  * won't be affected when the host system date is changed. In the
@@ -40,15 +39,11 @@
  * The implementation maintains a per-clock epoch value, so that
  * different emulators can have different (virtual) system dates.
  */
-#ifndef CONFIG_XENO_COPPERPLATE_CLOCK_RESTRICTED
-#ifdef CONFIG_XENO_RAW_CLOCK_ENABLED
-#define CLOCK_COPPERPLATE  CLOCK_MONOTONIC_RAW
+#ifdef CONFIG_XENO_COPPERPLATE_CLOCK_RESTRICTED
+#define CLOCK_COPPERPLATE  CLOCK_REALTIME
 #else
 #define CLOCK_COPPERPLATE  CLOCK_MONOTONIC
 #endif
-#else /* CONFIG_XENO_COPPERPLATE_CLOCK_RESTRICTED */
-#define CLOCK_COPPERPLATE  CLOCK_REALTIME
-#endif /* CONFIG_XENO_COPPERPLATE_CLOCK_RESTRICTED */
 
 struct clockobj {
        pthread_mutex_t lock;


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

Reply via email to