--- /dev/null
+// $Id$
+//
+// Copyright (C) 2011
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Thorsten Horstmann <tho@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief Scheduler ConsoleDir non-inline non-template implementation */
+
+#include "ConsoleDir.hh"
+#include "ConsoleDir.ih"
+
+// Custom includes
+#include <senf/Utils/Console/ScopedDirectory.hh>
+#include <senf/Utils/Console/Sysdir.hh>
+
+#define prefix_
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+
+prefix_ senf::console::ScopedDirectory<> & senf::scheduler::consoleDir()
+{
+ return detail::ConsoleDirManager::instance().consoleDir();
+}
+
+prefix_ senf::console::ScopedDirectory<> &
+senf::scheduler::detail::ConsoleDirManager::consoleDir()
+{
+ return consoleDir_();
+}
+
+prefix_ senf::scheduler::detail::ConsoleDirManager::ConsoleDirManager()
+{
+ console::sysdir().add("scheduler", consoleDir_());
+}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+#undef prefix_
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
--- /dev/null
+// $Id$
+//
+// Copyright (C) 2011
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Thorsten Horstmann <tho@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief Scheduler ConsoleDir public header */
+
+#ifndef HH_SENF_Scheduler_ConsoleDir_
+#define HH_SENF_Scheduler_ConsoleDir_ 1
+
+// Custom includes
+#include <senf/Utils/Console/LazyDirectory.hh>
+
+//#include "Sysdir.mpp"
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace senf {
+namespace scheduler {
+
+ console::ScopedDirectory<> & consoleDir();
+
+}}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+//#include "ConsoleDir.cci"
+//#include "ConsoleDir.ct"
+//#include "ConsoleDir.cti"
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
--- /dev/null
+// $Id$
+//
+// Copyright (C) 2011
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Thorsten Horstmann <tho@berlios.de>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc.,
+// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/** \file
+ \brief Scheduler ConsoleDir internal header */
+
+#ifndef IH_SENF_Scheduler_ConsoleDir_
+#define IH_SENF_Scheduler_ConsoleDir_ 1
+
+// Custom includes
+#include <senf/Utils/singleton.hh>
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace senf {
+namespace scheduler {
+namespace detail {
+
+ class ConsoleDirManager
+ : public singleton<ConsoleDirManager>
+ {
+ public:
+ using singleton<ConsoleDirManager>::instance;
+ using singleton<ConsoleDirManager>::alive;
+
+ console::ScopedDirectory<> & consoleDir();
+
+ private:
+ ConsoleDirManager();
+
+ console::LazyDirectory consoleDir_;
+
+ friend class singleton<ConsoleDirManager>;
+ };
+
+}}}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+#endif
+
+\f
+// Local Variables:
+// mode: c++
+// fill-column: 100
+// comment-column: 40
+// c-file-style: "senf"
+// indent-tabs-mode: nil
+// ispell-local-dictionary: "american"
+// compile-command: "scons -u test"
+// End:
#include <senf/Utils/membind.hh>
#include <senf/Utils/Console/ScopedDirectory.hh>
#include <senf/Utils/Console/ParsedCommand.hh>
-#include <senf/Utils/Console/Sysdir.hh>
+#include "ConsoleDir.hh"
#include "FIFORunner.hh"
//#include "EventManager.mpp"
prefix_ senf::scheduler::detail::EventManager::EventManager()
{
#ifndef SENF_DISABLE_CONSOLE
- consoleDir_().add("events", senf::console::factory::Command(
- senf::membind(&EventManager::listEvents, this))
+ consoleDir().add("events", console::factory::Command(
+ membind(&EventManager::listEvents, this))
.doc("List all scheduler events sorted by priority\n"
"\n"
"Columns:\n"
" - event disabled\n"
" INFO further event specific information")
);
-
- senf::console::sysdir().add("scheduler", consoleDir_());
#endif
}
#include <senf/boost_intrusive/ilist.hpp>
#include <senf/boost_intrusive/ilist_hook.hpp>
#include <senf/Utils/singleton.hh>
-#include <senf/Utils/Console/LazyDirectory.hh>
//#include "EventManager.mpp"
//-/////////////////////////////////////////////////////////////////////////////////////////////////
EventList events_;
friend class singleton<EventManager>;
-
-#ifndef SENF_DISABLE_CONSOLE
- console::LazyDirectory consoleDir_;
-#endif
};
}}}
#include <signal.h>
#include <time.h>
#include <cassert>
-#include <senf/Utils/Exception.hh>
-#include <senf/Utils/senfassert.hh>
#ifdef SENF_DEBUG
#include <execinfo.h>
#endif
#include <senf/config.hh>
#include <stdint.h>
#include <stdio.h>
+#include <senf/Utils/Exception.hh>
+#include <senf/Utils/senfassert.hh>
#include "senf/Utils/IgnoreValue.hh"
+#include <senf/Utils/Console/ScopedDirectory.hh>
+#include <senf/Utils/Console/ParsedCommand.hh>
+#include "ConsoleDir.hh"
//#include "FIFORunner.mpp"
#define prefix_
tasks_.push_back(highPriorityEnd_);
tasks_.push_back(normalPriorityEnd_);
+
+#ifndef SENF_DISABLE_CONSOLE
+ namespace fty = console::factory;
+ consoleDir().add("abortOnWatchdocTimeout", fty::Command(
+ SENF_MEMBINDFNP( bool, FIFORunner, abortOnTimeout, () const ))
+ .doc("Get current watchdog abort on event status.") );
+ consoleDir().add("abortOnWatchdocTimeout", fty::Command(
+ SENF_MEMBINDFNP( void, FIFORunner, abortOnTimeout, (bool) ))
+ .doc("Enable/disable abort on watchdog event.") );
+ consoleDir().add("watchdogTimeout", fty::Command(
+ SENF_MEMBINDFNP( unsigned, FIFORunner, taskTimeout, () const ))
+ .doc("Get current watchdog timeout in milliseconds") );
+ consoleDir().add("watchdogTimeout", fty::Command(
+ SENF_MEMBINDFNP( void, FIFORunner, taskTimeout, (unsigned) ))
+ .doc("Set watchdog timeout to in milliseconds\n"
+ "Setting the watchdog timeout to 0 will disable the watchdog.") );
+ consoleDir().add("watchdogEvents", fty::Command(membind( &FIFORunner::hangCount, this))
+ .doc("Get number of occurred watchdog events.\n"
+ "Calling this method will reset the counter to 0") );
+#endif
}
prefix_ senf::scheduler::detail::FIFORunner::~FIFORunner()
{
timer_delete(watchdogId_);
signal(SIGURG, SIG_DFL);
+
+#ifndef SENF_DISABLE_CONSOLE
+ consoleDir().remove("abortOnWatchdocTimeout");
+ consoleDir().remove("watchdogTimeout");
+ consoleDir().remove("watchdogEvents");
+#endif
}
prefix_ void senf::scheduler::detail::FIFORunner::startWatchdog()
\li senf::scheduler::SignalEvent for UNIX signal events
\li senf::scheduler::EventHook for a special event hook
- These instance are owned and managed by the user of the scheduler \e not by the scheduler so the
- RAII concept can be used.
+ These instance are owned and managed by the user of the %scheduler \e not by the %scheduler so
+ the RAII concept can be used.
\code
class SomeServer
The event is defined as a class member variable. When the event member is initialized in the
constructor, the event is automatically registered (except if the optional \a initiallyEnabled
flag argument is set to \c false). The Destructor will automatically remove the event from the
- scheduler and ensure, that no dead code is called accidentally.
+ %scheduler and ensure, that no dead code is called accidentally.
The process is the same for the other event types or when registering multiple events. For
detailed information on the constructor arguments and other features see the event class
\section sched_exec Executing the Scheduler
- To enter the scheduler main-loop, call
+ To enter the %scheduler main-loop, call
\code
senf::scheduler::process();
To secure against blocking callbacks, the %scheduler implementation includes a watchdog
timer. This timer will produce a warning message on the standard error stream when a single
- callback is executing for more than the watchdog timeout value. Since the scheduler
+ callback is executing for more than the watchdog timeout value. Since the %scheduler
implementation is completely single threaded, we cannot terminate the callback but at least we
can produce an informative message and optionally the program can be aborted.
if (pidfileCreated_) {
try {
LIBC_CALL( ::unlink, (pidfile_.c_str()) );
- } catch (Exception e) {
+ } catch (Exception & e) {
// e << "; could not unlink " << pidfile_.c_str();
// throw;
}
// Implementation details concerning SENF_LOG_CLASS_AREA
//
// The SENF_LOG_CLASS_AREA statement shall declare the containing class as it's own default area. Of
-// course, we cannot make the containing class into an area. Therefor we need to trick around a bit:
+// course, we cannot make the containing class into an area. Therefore we need to trick around a bit:
//
// We begin by defining an area SENFLogArea with in the class. This area however is hacked, so that
// it's name() member will return the name of the containing class (which is simple: just cut of the
/** \brief Log target writing to the syslog
- The SyslogTarget will send all log messages to the syslog at the given facility.
+ The SyslogTarget will send all %log messages to the syslog at the given facility.
\code
senf::log::SyslogTarget syslog;
# files needed explicitly.
#
# This works by building a list of all children (recursively) of the
-# test sources. For each child we check, wether a file with the same
+# test sources. For each child we check, whether a file with the same
# name but an $OBJSUFFIX extension exists as a build target. In that
# case, we add it to the list of needed objects (AND recursively scan
# that objects children).
FooParser
ForwardingRoute
ForwardRange
+fragmentation
fraunhofer
FroblizerArea
fsiCe
hh
hideinitializer
Hmm
+horstmann
hostname
hostnames
howto
protocolbundle
protocolbundles
protocolType
+proxy
ptr
PUSHD
py
xmlsoft
XSLT
xsltproc
-xxxx
-xxxxxx
-xyz