// $Id$
//
// Copyright (C) 2006
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
-// Stefan Bund <stefan.bund@fokus.fraunhofer.de>
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
+// Stefan Bund <g0dil@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
#include <boost/call_traits.hpp>
#include <boost/integer.hpp>
#include "ClockService.hh"
-#include "../Utils/Logger.hh"
+#include "../Utils/Logger/SenfLog.hh"
//#include "scheduler.mpp"
///////////////////////////////hh.p////////////////////////////////////////
wait for signals \e only.
\todo Fix EventId parameter (probably to int) to allow |-ing without casting ...
+
+ \todo Fix the file support to use threads (?) fork (?) and a pipe so it works reliably even
+ over e.g. NFS.
*/
class Scheduler
: boost::noncopyable
sole member is a typedef symbol defining the callback type given the handle type.
The Callback is any callable object taking a \c Handle and an \c EventId as argument.
- template <class Handle>
- struct GenericCallback {
- typedef boost::function<void (typename boost::call_traits<Handle>::param_type,
- EventId) > Callback;
- };
+ \code
+ template <class Handle>
+ struct GenericCallback {
+ typedef boost::function<void (typename boost::call_traits<Handle>::param_type,
+ EventId) > Callback;
+ };
+ \endcode
*/
-
typedef boost::function<void (EventId)> FdCallback;
/** \brief Callback type for timer events */
void unregisterSignal(unsigned signal);
///< Remove signal handler for \a signal
+ /// The signal number passed to registerSignal or unregisterSignal is invalid
struct InvalidSignalNumberException : public std::exception
{ virtual char const * what() const throw()
{ return "senf::Scheduler::InvalidSignalNumberException"; } };
FdCallback cb_prio;
FdCallback cb_write;
+ EventSpec() : file(false) {}
+
int epollMask() const;
+
+ bool file;
};
/** \brief Timer event specification
typedef std::map<int,EventSpec> FdTable;
typedef std::map<unsigned,TimerSpec> TimerMap; // sorted by id
+ typedef std::vector<unsigned> FdEraseList;
# ifndef DOXYGEN
typedef std::vector<SimpleCallback> SigHandlers;
FdTable fdTable_;
+ FdEraseList fdErase_;
+ unsigned files_;
unsigned timerIdCounter_;
TimerQueue timerQueue_;