From: jmo Date: Wed, 13 Feb 2008 10:53:56 +0000 (+0000) Subject: extended documentation example X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=5b2e6f429a45b3bec23c52bd81a9726b9dbbcf68;p=senf.git extended documentation example git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@692 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Scheduler/Scheduler.hh b/Scheduler/Scheduler.hh index 8c73cda..706ee5b 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