
Module: ppl/ppl Branch: master Commit: 9b0ba93300fb829608d40e766b9f3f95c81962e1 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=9b0ba93300fb8...
Author: Roberto Bagnara bagnara@cs.unipr.it Date: Sun Feb 21 12:49:16 2010 +0100
sigaction() is also needed, in addition to setitimer() in order to support Watchdog objects. We could check if signal() is available if there is request for such a feature.
---
Watchdog/src/Watchdog.cc | 4 ++-- Watchdog/src/Watchdog.defs.hh | 12 ++++++------ Watchdog/src/Watchdog.inlines.hh | 6 +++--- Watchdog/src/pwl_header.hh | 3 ++- 4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/Watchdog/src/Watchdog.cc b/Watchdog/src/Watchdog.cc index 84ccda3..93449be 100644 --- a/Watchdog/src/Watchdog.cc +++ b/Watchdog/src/Watchdog.cc @@ -26,7 +26,7 @@ site: http://www.cs.unipr.it/ppl/ . */
namespace PWL = Parma_Watchdog_Library;
-#if PWL_HAVE_DECL_SETITIMER +#if PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION
#include <csignal> #include <iostream> @@ -244,4 +244,4 @@ PWL::Watchdog::finalize() {
unsigned int PWL::Init::count = 0;
-#endif // PWL_HAVE_DECL_SETITIMER +#endif // PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION diff --git a/Watchdog/src/Watchdog.defs.hh b/Watchdog/src/Watchdog.defs.hh index 674954d..7e0f6f5 100644 --- a/Watchdog/src/Watchdog.defs.hh +++ b/Watchdog/src/Watchdog.defs.hh @@ -61,7 +61,7 @@ public: //! Destructor. ~Watchdog();
-#if PWL_HAVE_DECL_SETITIMER +#if PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION
private: typedef Pending_List<Watchdog_Traits> WD_Pending_List; @@ -133,10 +133,10 @@ private:
friend void PWL_handle_timeout(int signum);
-#endif // PWL_HAVE_DECL_SETITIMER +#endif // PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION };
-#if PWL_HAVE_DECL_SETITIMER +#if PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION
class Init { private: @@ -151,13 +151,13 @@ public: ~Init(); };
-#endif // PWL_HAVE_DECL_SETITIMER +#endif // PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION
} // namespace Parma_Watchdog_Library
#include "Watchdog.inlines.hh"
-#if PWL_HAVE_DECL_SETITIMER +#if PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION
namespace {
@@ -165,7 +165,7 @@ Parma_Watchdog_Library::Init Parma_Watchdog_Library_initializer;
} // namespace
-#endif // PWL_HAVE_DECL_SETITIMER +#endif // PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION
#endif // !defined(PWL_Watchdog_defs_hh)
diff --git a/Watchdog/src/Watchdog.inlines.hh b/Watchdog/src/Watchdog.inlines.hh index 6cdd654..6591359 100644 --- a/Watchdog/src/Watchdog.inlines.hh +++ b/Watchdog/src/Watchdog.inlines.hh @@ -29,7 +29,7 @@ site: http://www.cs.unipr.it/ppl/ . */
namespace Parma_Watchdog_Library {
-#if PWL_HAVE_DECL_SETITIMER +#if PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION
template <typename Flag_Base, typename Flag> Watchdog::Watchdog(unsigned int units, @@ -89,7 +89,7 @@ Init::~Init() { } }
-#else // !PWL_HAVE_DECL_SETITIMER +#else // !PWL_HAVE_DECL_SETITIMER !! !PWL_HAVE_DECL_SIGACTION
template <typename Flag_Base, typename Flag> Watchdog::Watchdog(unsigned int /* units */, @@ -109,7 +109,7 @@ inline Watchdog::~Watchdog() { }
-#endif // !PWL_HAVE_DECL_SETITIMER +#endif // !PWL_HAVE_DECL_SETITIMER !! !PWL_HAVE_DECL_SIGACTION
} // namespace Parma_Watchdog_Library
diff --git a/Watchdog/src/pwl_header.hh b/Watchdog/src/pwl_header.hh index 3a65df6..8df3a05 100644 --- a/Watchdog/src/pwl_header.hh +++ b/Watchdog/src/pwl_header.hh @@ -32,7 +32,8 @@ site: http://www.cs.unipr.it/ppl/ . */ #include "pwl_include_files.hh"
//! Defined to 1 if PWL::Watchdog objects are supported, to 0 otherwise. -#define PWL_WATCHDOG_OBJECTS_ARE_SUPPORTED PWL_HAVE_DECL_SETITIMER +#define PWL_WATCHDOG_OBJECTS_ARE_SUPPORTED \ + (PWL_HAVE_DECL_SETITIMER && PWL_HAVE_DECL_SIGACTION)
#ifdef PWL_SAVE_NDEBUG # ifndef NDEBUG