2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief Scheduler inline non-template implementation
18 //#include "Scheduler.ih"
21 #include <boost/format.hpp>
23 #define prefix_ inline
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 prefix_ senf::ClockService::clock_type const & senf::scheduler::eventTime()
30 return scheduler::detail::FdManager::instance().eventTime();
33 prefix_ senf::ClockService::clock_type const & senf::scheduler::now()
35 return scheduler::detail::FdManager::instance().eventTime();
38 prefix_ senf::ClockService::clock_type senf::scheduler::nowDiff(ClockService::clock_type const & older)
43 prefix_ senf::CyclicTimestamp const & senf::scheduler::eventTimestamp()
45 return scheduler::detail::FdManager::instance().eventTimestamp();
48 prefix_ void senf::scheduler::watchdogCallback(detail::FIFORunner::WatchdogCallback const & cb)
50 scheduler::detail::FIFORunner::instance().watchdogCallback(cb);
53 prefix_ void senf::scheduler::watchdogTimeout(unsigned ms)
55 scheduler::detail::FIFORunner::instance().taskTimeout(ms);
58 prefix_ unsigned senf::scheduler::watchdogTimeout()
60 return scheduler::detail::FIFORunner::instance().taskTimeout();
63 prefix_ unsigned senf::scheduler::watchdogEvents()
65 return scheduler::detail::FIFORunner::instance().hangCount();
68 prefix_ void senf::scheduler::watchdogAbort(bool flag)
70 scheduler::detail::FIFORunner::instance().abortOnTimeout(flag);
73 prefix_ bool senf::scheduler::watchdogAbort()
75 return scheduler::detail::FIFORunner::instance().abortOnTimeout();
78 prefix_ void senf::scheduler::loresTimers()
80 detail::TimerDispatcher::instance().timerSource(
81 std::unique_ptr<detail::TimerSource>(new detail::PollTimerSource()));
84 prefix_ bool senf::scheduler::haveScalableHiresTimers()
86 #ifndef HAVE_TIMERFD_CREATE
89 return detail::TimerFDTimerSource::haveTimerFD();
93 prefix_ bool senf::scheduler::usingHiresTimers()
95 return dynamic_cast<detail::PollTimerSource*>(
96 detail::TimerDispatcher::instance().timerSource()) == nullptr;
100 //-/////////////////////////////////////////////////////////////////////////////////////////////////
101 // senf::scheduler::BlockSignals
103 prefix_ senf::scheduler::BlockSignals::~BlockSignals()
108 prefix_ bool senf::scheduler::BlockSignals::blocked()
114 //-/////////////////////////////////////////////////////////////////////////////////////////////////
121 // c-file-style: "senf"
122 // indent-tabs-mode: nil
123 // ispell-local-dictionary: "american"
124 // compile-command: "scons -u test"
125 // comment-column: 40