[PPL-devel] [GIT] ppl/ppl(master): Converted watchdog time argument to unsigned.
Abramo Bagnara
abramo.bagnara at gmail.com
Sun Jul 12 14:19:53 CEST 2009
Module: ppl/ppl
Branch: master
Commit: a349f75ba19a1bb4c40f6e47da0d8261546be193
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=a349f75ba19a1bb4c40f6e47da0d8261546be193
Author: Abramo Bagnara <abramo.bagnara at gmail.com>
Date: Sun Jul 12 13:55:14 2009 +0200
Converted watchdog time argument to unsigned.
---
TODO | 2 --
Watchdog/src/Watchdog.cc | 2 +-
Watchdog/src/Watchdog.defs.hh | 10 +++++-----
Watchdog/src/Watchdog.inlines.hh | 9 +++++----
4 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/TODO b/TODO
index 8f298f8..47cbef8 100644
--- a/TODO
+++ b/TODO
@@ -9,8 +9,6 @@ Enhancements for PPL 0.11
- Make all the *affine*image() methods uniform as far as the
specification is concerned.
- Check the use or the NOT_EQUAL Relation_Symbol everywhere.
-- Reconsider the datatype for the units parameter in the Watchdog
- constructors: should we prefer an unsigned?
- Intervals are best instantiated with checked numbers with
particular policies: review all the interfaced boxes,
augment the testsuite, and update the documentation.
diff --git a/Watchdog/src/Watchdog.cc b/Watchdog/src/Watchdog.cc
index beca915..ff23467 100644
--- a/Watchdog/src/Watchdog.cc
+++ b/Watchdog/src/Watchdog.cc
@@ -160,7 +160,7 @@ PWL::PWL_handle_timeout(int signum) {
}
PWL::Watchdog::WD_Pending_List::Iterator
-PWL::Watchdog::new_watchdog_event(int units,
+PWL::Watchdog::new_watchdog_event(unsigned int units,
const Handler& handler,
bool& expired_flag) {
assert(units > 0);
diff --git a/Watchdog/src/Watchdog.defs.hh b/Watchdog/src/Watchdog.defs.hh
index edec34d..4dfffee 100644
--- a/Watchdog/src/Watchdog.defs.hh
+++ b/Watchdog/src/Watchdog.defs.hh
@@ -50,9 +50,9 @@ struct Watchdog_Traits {
class Watchdog {
public:
template <typename Flag_Base, typename Flag>
- Watchdog(int units, const Flag_Base* volatile& holder, Flag& flag);
+ Watchdog(unsigned int units, const Flag_Base* volatile& holder, Flag& flag);
- Watchdog(int units, void (*function)());
+ Watchdog(unsigned int units, void (*function)());
~Watchdog();
@@ -105,9 +105,9 @@ private:
static void handle_timeout(int);
// Handle the addition of a new watchdog event.
- static WD_Pending_List::Iterator new_watchdog_event(int units,
- const Handler& handler,
- bool& expired_flag);
+ static WD_Pending_List::Iterator new_watchdog_event(unsigned int units,
+ const Handler& handler,
+ bool& expired_flag);
// Handle the removal of a watchdog event.
void remove_watchdog_event(WD_Pending_List::Iterator position);
diff --git a/Watchdog/src/Watchdog.inlines.hh b/Watchdog/src/Watchdog.inlines.hh
index 0938216..04e1045 100644
--- a/Watchdog/src/Watchdog.inlines.hh
+++ b/Watchdog/src/Watchdog.inlines.hh
@@ -35,10 +35,11 @@ Watchdog::reschedule() {
}
template <typename Flag_Base, typename Flag>
-Watchdog::Watchdog(int units, const Flag_Base* volatile& holder, Flag& flag)
+Watchdog::Watchdog(unsigned int units,
+ const Flag_Base* volatile& holder, Flag& flag)
: expired(false),
handler(*new Handler_Flag<Flag_Base, Flag>(holder, flag)) {
- if (units <= 0)
+ if (units == 0)
throw std::invalid_argument("Watchdog constructor called with a"
" non-positive number of time units");
in_critical_section = true;
@@ -47,9 +48,9 @@ Watchdog::Watchdog(int units, const Flag_Base* volatile& holder, Flag& flag)
}
inline
-Watchdog::Watchdog(int units, void (*function)())
+Watchdog::Watchdog(unsigned int units, void (*function)())
: expired(false), handler(*new Handler_Function(function)) {
- if (units <= 0)
+ if (units == 0)
throw std::invalid_argument("Watchdog constructor called with a"
" non-positive number of time units");
in_critical_section = true;
More information about the PPL-devel
mailing list