00001 // $Id: Scheduler.cci 1742 2010-11-04 14:51:56Z g0dil $ 00002 // 00003 // Copyright (C) 2006 00004 // Fraunhofer (FOKUS) 00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY 00006 // Stefan Bund <g0dil@berlios.de> 00007 // 00008 // This program is free software; you can redistribute it and/or modify 00009 // it under the terms of the GNU General Public License as published by 00010 // the Free Software Foundation; either version 2 of the License, or 00011 // (at your option) any later version. 00012 // 00013 // This program is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 // GNU General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU General Public License 00019 // along with this program; if not, write to the 00020 // Free Software Foundation, Inc., 00021 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 00027 //#include "Scheduler.ih" 00028 00029 // Custom includes 00030 #include <boost/format.hpp> 00031 00032 #define prefix_ inline 00033 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00034 00035 // public members 00036 00037 prefix_ senf::ClockService::clock_type senf::scheduler::eventTime() 00038 { 00039 return scheduler::detail::FdManager::instance().eventTime(); 00040 } 00041 00042 prefix_ void senf::scheduler::watchdogTimeout(unsigned ms) 00043 { 00044 scheduler::detail::FIFORunner::instance().taskTimeout(ms); 00045 } 00046 00047 prefix_ unsigned senf::scheduler::watchdogTimeout() 00048 { 00049 return scheduler::detail::FIFORunner::instance().taskTimeout(); 00050 } 00051 00052 prefix_ unsigned senf::scheduler::watchdogEvents() 00053 { 00054 return scheduler::detail::FIFORunner::instance().hangCount(); 00055 } 00056 00057 prefix_ void senf::scheduler::watchdogAbort(bool flag) 00058 { 00059 scheduler::detail::FIFORunner::instance().abortOnTimeout(flag); 00060 } 00061 00062 prefix_ bool senf::scheduler::watchdogAbort() 00063 { 00064 return scheduler::detail::FIFORunner::instance().abortOnTimeout(); 00065 } 00066 00067 prefix_ void senf::scheduler::loresTimers() 00068 { 00069 detail::TimerDispatcher::instance().timerSource( 00070 std::auto_ptr<detail::TimerSource>(new detail::PollTimerSource())); 00071 } 00072 00073 prefix_ bool senf::scheduler::haveScalableHiresTimers() 00074 { 00075 #ifndef HAVE_TIMERFD_CREATE 00076 return false; 00077 #else 00078 return detail::TimerFDTimerSource::haveTimerFD(); 00079 #endif 00080 } 00081 00082 prefix_ bool senf::scheduler::usingHiresTimers() 00083 { 00084 return dynamic_cast<detail::PollTimerSource*>( 00085 detail::TimerDispatcher::instance().timerSource()) == 0; 00086 } 00087 00088 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00089 // senf::scheduler::BlockSignals 00090 00091 prefix_ senf::scheduler::BlockSignals::~BlockSignals() 00092 { 00093 unblock(); 00094 } 00095 00096 prefix_ bool senf::scheduler::BlockSignals::blocked() 00097 const 00098 { 00099 return blocked_; 00100 } 00101 00102 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00103 #undef prefix_ 00104 00105 00106 // Local Variables: 00107 // mode: c++ 00108 // fill-column: 100 00109 // c-file-style: "senf" 00110 // indent-tabs-mode: nil 00111 // ispell-local-dictionary: "american" 00112 // compile-command: "scons -u test" 00113 // comment-column: 40 00114 // End: