]> git.llucax.com Git - software/eventxx.git/blobdiff - README
Fixed the main documentation example which was *WRONG*.
[software/eventxx.git] / README
diff --git a/README b/README
index 380ecfb4ab22da03364228ba31fa8d66b13e0fed..dbc5a6ade4f8b71672f19099469425829373a6a2 100644 (file)
--- a/README
+++ b/README
@@ -92,6 +92,7 @@ struct handler
        handler(eventxx::dispatcher& d): d(d), i(0) {}
        void operator() (int signum, eventxx::type event)
        {
+               std::cout << ++i << " interrupts, ";
                if (i < 5) std::cout << "keep going...\n";
                else
                {
@@ -101,19 +102,18 @@ struct handler
        }
 };
 
-void sighandler(int signum, short event, void* data)
+void timer_handler(int, short, void*)
 {
-       int& i = *static_cast< int* >(data);
-       std::cout << ++i << " interrupts, ";
+       std::cout << "Press Ctrl-C 5 times to quit.\n";
 }
 
 int main()
 {
        eventxx::dispatcher d;
        handler h(d);
-       eventxx::csignal sigev(SIGINT, sighandler, &h.i);
+       eventxx::ctimer t(timer_handler);
        eventxx::signal< handler > e(SIGINT, h);
-       d.add(sigev);
+       d.add(t, eventxx::time(1)); // 1 second
        d.add(e);
        d.dispatch();
        return 0;