eba3cb3a62e643e078b7eb0dc1fe252d10991a70
[senf.git] / senf / Scheduler / Scheduler.cci
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief Scheduler inline non-template implementation
25  */
26
27 //#include "Scheduler.ih"
28
29 // Custom includes
30 #include <boost/format.hpp>
31
32 #define prefix_ inline
33 ///////////////////////////////cci.p///////////////////////////////////////
34
35 // public members
36
37 prefix_ senf::ClockService::clock_type senf::scheduler::eventTime()
38 {
39     return scheduler::detail::FdManager::instance().eventTime();
40 }
41
42 prefix_ void senf::scheduler::watchdogTimeout(unsigned ms)
43 {
44     scheduler::detail::FIFORunner::instance().taskTimeout(ms);
45 }
46
47 prefix_ unsigned senf::scheduler::watchdogTimeout()
48 {
49     return scheduler::detail::FIFORunner::instance().taskTimeout();
50 }
51
52 prefix_ unsigned senf::scheduler::watchdogEvents()
53 {
54     return scheduler::detail::FIFORunner::instance().hangCount();
55 }
56
57 prefix_ void senf::scheduler::watchdogAbort(bool flag)
58 {
59     scheduler::detail::FIFORunner::instance().abortOnTimeout(flag);
60 }
61
62 prefix_ bool senf::scheduler::watchdogAbort()
63 {
64     return scheduler::detail::FIFORunner::instance().abortOnTimeout();
65 }
66
67 prefix_ void senf::scheduler::loresTimers()
68 {
69     detail::TimerDispatcher::instance().timerSource(
70         std::auto_ptr<detail::TimerSource>(new detail::PollTimerSource()));
71 }
72
73 prefix_ bool senf::scheduler::haveScalableHiresTimers()
74 {
75 #ifndef HAVE_TIMERFD_CREATE
76     return false;
77 #else
78     return detail::TimerFDTimerSource::haveTimerFD();
79 #endif
80 }
81
82 prefix_ bool senf::scheduler::usingHiresTimers()
83 {
84     return dynamic_cast<detail::PollTimerSource*>(
85         detail::TimerDispatcher::instance().timerSource()) == 0;
86 }
87
88 ///////////////////////////////////////////////////////////////////////////
89 // senf::scheduler::BlockSignals
90
91 prefix_ senf::scheduler::BlockSignals::~BlockSignals()
92 {
93     unblock();
94 }
95
96 prefix_ bool senf::scheduler::BlockSignals::blocked()
97     const
98 {
99     return blocked_;
100 }
101
102 ///////////////////////////////cci.e///////////////////////////////////////
103 #undef prefix_
104
105 \f
106 // Local Variables:
107 // mode: c++
108 // fill-column: 100
109 // c-file-style: "senf"
110 // indent-tabs-mode: nil
111 // ispell-local-dictionary: "american"
112 // compile-command: "scons -u test"
113 // comment-column: 40
114 // End: