X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FScheduler.hh;h=0d51c35b4b99e6818411ca97bc7bc56b36c5767d;hb=489be2bbd4d03259a17df14e4962a4524cd5b654;hp=8c73cdac42a1ca5561348c82be499b7ada463075;hpb=1d247d12d1759ffd77f456efe3a52f03dd289994;p=senf.git
diff --git a/Scheduler/Scheduler.hh b/Scheduler/Scheduler.hh
index 8c73cda..0d51c35 100644
--- a/Scheduler/Scheduler.hh
+++ b/Scheduler/Scheduler.hh
@@ -72,8 +72,12 @@ namespace senf {
If you need to pass additional information to your handler, use Boost.Bind:
\code
+ // Handle callback function
+ void callback(UDPv4ClientSocketHandle handle, senf::Scheduler::EventId event) {..}
// Pass 'handle' as additional first argument to callback()
- Scheduler::instance().add(handle, boost::bind(&callback, handle, _1))
+ Scheduler::instance().add(handle, boost::bind(&callback, handle, _1), EV_READ)
+ // Timeout function
+ void timeout( int n) {..}
// Call timeout() handler with argument 'n'
Scheduler::instance().timeout(boost::bind(&timeout, n))
\endcode
@@ -82,7 +86,7 @@ namespace senf {
href="http://www.boost.org/libs/bind/bind.html">Boost.Bind or senf::membind()
\code
// e.g. in Foo::Foo() constructor:
- Scheduler::instance().add(handle_, senf::membind(&Foo::callback, this))
+ Scheduler::instance().add(handle_, senf::membind(&Foo::callback, this)), EV_READ)
\endcode
@@ -90,7 +94,7 @@ namespace senf {
File descriptors are managed using add() or remove()
\code
- Scheduler::instance().add(handle, &callback);
+ Scheduler::instance().add(handle, &callback, EV_ALL);
Scheduler::instance().remove(handle);
\endcode
@@ -156,6 +160,9 @@ namespace senf {
\todo Fix the file support to use threads (?) fork (?) and a pipe so it works reliably even
over e.g. NFS.
+
+ \todo Add a check in the alarm callback which is already called every x seconds to check,
+ that a single callback is not blocking.
*/
class Scheduler
: boost::noncopyable
@@ -246,7 +253,8 @@ namespace senf {
the Handle interface defined above.
\param[in] cb callback
\param[in] eventMask arbitrary combination via '|'
- operator of EventId designators. */
+ operator of \ref senf::Scheduler::EventId "EventId"
+ designators. */
template
void remove(Handle const & handle, int eventMask = EV_ALL); ///< Remove event callback
/**< remove() will remove any callback registered for any of
@@ -255,8 +263,8 @@ namespace senf {
\param[in] handle file descriptor or handle providing
the Handle interface defined above.
\param[in] eventMask arbitrary combination via '|'
- operator of EventId designators. */
-
+ operator of \ref senf::Scheduler::EventId "EventId"
+ designators. */
///\}
///\name Timeouts
@@ -264,7 +272,8 @@ namespace senf {
unsigned timeout(ClockService::clock_type timeout, SimpleCallback const & cb);
///< Add timeout event
- /**< \param[in] timeout timeout in nanoseconds
+ /**< \returns timer id
+ \param[in] timeout timeout in nanoseconds
\param[in] cb callback to call after \a timeout
milliseconds */