00001 // $Id: Scheduler.hh 1771 2011-03-08 14:43:47Z tho $ 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 #ifndef HH_SENF_Scheduler_Scheduler_ 00028 #define HH_SENF_Scheduler_Scheduler_ 1 00029 00030 // Custom includes 00031 #include <boost/utility.hpp> 00032 #include <senf/Utils/Logger/TimeSource.hh> 00033 #include "FdEvent.hh" 00034 #include "TimerEvent.hh" 00035 #include "SignalEvent.hh" 00036 #include "IdleEvent.hh" 00037 #include "EventHook.hh" 00038 00039 //#include "scheduler.mpp" 00040 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00041 00042 namespace senf { 00043 00228 namespace scheduler { 00229 00237 void process(); 00238 00240 bool running(); 00241 00247 void terminate(); 00248 00254 void yield(); 00255 00261 ClockService::clock_type eventTime(); 00262 00270 ClockService::clock_type now(); 00271 00276 void watchdogTimeout(unsigned ms); 00277 00279 unsigned watchdogTimeout(); 00280 00285 unsigned watchdogEvents(); 00286 00292 void watchdogAbort(bool flag); 00293 00295 bool watchdogAbort(); 00296 00311 void hiresTimers(); 00312 00316 void loresTimers(); 00317 00321 bool haveScalableHiresTimers(); 00322 00325 bool usingHiresTimers(); 00326 00333 void restart(); 00334 00336 bool empty(); 00337 00351 struct LogTimeSource : public senf::log::TimeSource 00352 { 00353 senf::log::time_type operator()() const; 00354 }; 00355 00373 class BlockSignals 00374 : boost::noncopyable 00375 { 00376 public: 00377 BlockSignals(bool initiallyBlocked=true); 00379 00381 ~BlockSignals(); 00382 00383 void block(); 00384 void unblock(); 00385 bool blocked() const; 00386 00387 00388 private: 00389 bool blocked_; 00390 sigset_t allSigs_; 00391 sigset_t savedSigs_; 00392 }; 00393 00394 }} 00395 00396 //-///////////////////////////////////////////////////////////////////////////////////////////////// 00397 #include "Scheduler.cci" 00398 //#include "Scheduler.ct" 00399 //#include "Scheduler.cti" 00400 #endif 00401 00402 00403 // Local Variables: 00404 // mode: c++ 00405 // fill-column: 100 00406 // c-file-style: "senf" 00407 // indent-tabs-mode: nil 00408 // ispell-local-dictionary: "american" 00409 // compile-command: "scons -u test" 00410 // comment-column: 40 00411 // End: