Package: ppl / 0.10.2-8

9bdd6617be52573d3252687844d32001e671a126.debian Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From: Roberto Bagnara <bagnara@cs.unipr.it>
Date: Wed, 17 Feb 2010 10:56:08 +0000 (+0100)
Subject: Cater for systems where setitimer() is not provided (part 1).
X-Git-Url: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl%2Fppl.git;a=commitdiff_plain;h=9bdd6617be52573d3252687844d32001e671a126

Cater for systems where setitimer() is not provided (part 1).
---

diff --git a/Watchdog/src/Watchdog.defs.hh b/Watchdog/src/Watchdog.defs.hh
index eace4b3..3b1b3ba 100644
--- a/Watchdog/src/Watchdog.defs.hh
+++ b/Watchdog/src/Watchdog.defs.hh
@@ -61,6 +61,7 @@ public:
   Watchdog(int units, void (*function)());
   ~Watchdog();
 
+#if HAVE_DECL_SETITIMER
 
 private:
   friend class Init;
@@ -130,6 +132,8 @@ private:
   static volatile bool in_critical_section;
 
   friend void PWL_handle_timeout(int signum);
+
+#endif // HAVE_DECL_SETITIMER
 };
 
 class Init {
diff --git a/Watchdog/src/Watchdog.inlines.hh b/Watchdog/src/Watchdog.inlines.hh
index 47340fc..a24dd35 100644
--- a/Watchdog/src/Watchdog.inlines.hh
+++ b/Watchdog/src/Watchdog.inlines.hh
@@ -29,10 +29,7 @@ site: http://www.cs.unipr.it/ppl/ . */
 
 namespace Parma_Watchdog_Library {
 
-inline void
-Watchdog::reschedule() {
-  set_timer(reschedule_time);
-}
+#if HAVE_DECL_SETITIMER
 
 template <typename Flag_Base, typename Flag>
 Watchdog::Watchdog(int units, const Flag_Base* volatile& holder, Flag& flag)
@@ -58,6 +55,33 @@ Watchdog::Watchdog(int units, void (*function)())
   in_critical_section = false;
 }
 
+inline void
+Watchdog::reschedule() {
+  set_timer(reschedule_time);
+}
+
+#else // !HAVE_DECL_SETITIMER
+
+template <typename Flag_Base, typename Flag>
+Watchdog::Watchdog(int units,
+		   const Flag_Base* volatile& holder, Flag& flag) {
+  used(units);
+  used(holder);
+  used(flag);
+  throw std::runtime_error("PWL::Watchdog objects not supported:"
+                           " system does not provide setitimer()");
+}
+
+inline
+Watchdog::Watchdog(int units, void (*function)()) {
+  used(units);
+  used(function);
+  throw std::runtime_error("PWL::Watchdog objects not supported:"
+                           " system does not provide setitimer()");
+}
+
+#endif // HAVE_DECL_SETITIMER
+
 inline
 Init::Init() {
   // Only when the first Init object is constructed...