Ruslan Osmanov avatar Ruslan Osmanov committed 5bd526d

Initial

Comments (0)

Files changed (62)

+CVS
+acinclude.m4
+aclocal.m4
+autom4te.cache
+build
+install-sh
+libtool
+ltmain.sh
+missing
+mkinstalldirs
+modules
+reconf.sh
+run-tests.php
+tags
+
+*.in
+*.l[a,o]
+*.sw[p,o]
+*~
+*.deps
+*.libs
+*.diff
+*.log
+*.out
+*.exp
+Makefile*
+
+tests/*
+!tests/*.phpt
+
+config*
+!config.[m4,w32]
+ev
+Ruslan Osmanov

Empty file added.

+INSTALLATION OF EV PECL EXTENSION
+==================================
+
+Currently GNU/Linux platforms supported only.
+
+
+AUTOMATIC INSTALLATION
+----------------------
+
+To download and install ev automatically you need the following commands
+
+# pecl install ev
+
+for stable release(if available), and the following for beta release:
+
+# pecl install ev-beta
+
+If you have the package archive, unpack it and run: 
+
+# pecl install package2.xml
+
+Note, these commands(started with `#') most likely need root priveleges.
+
+libev is embedded in ev. So you don't need to install the library separately.
+
+
+MANUAL INSTALLATION
+-------------------
+
+Checkout the project or download it as archive. In the package directory run: 
+
+$ phpize 
+$ ./configure --with-ev
+$ make 
+
+Additionally, you may take advantage of the following flags:
+
+--enable-ev-debug         Enable ev internal debugging
+--enable-ev-libevent-api  Enable libevent compatibility API support
+
+Optionally test the extension:
+$ make test
+
+Do install with root priveleges:
+# make install
+
+In php.ini, or some other configuration like
+/usr/local/etc/php/conf.d/ev.ini write:
+
+extension=ev.so
+
+
+FINALLY
+------
+
+Restart the SAPI server(Apache, PHP-FPM etc.), if any.
+
+vim: tw=80:
+PHP API LAYOUT
+
+Files
+=====
+
+libev/*			Source code of libev
+php_ev.c		The main implementation of the extension
+php_ev.h		Extension metadata and common includes
+php_ev_embed.h	Embeds libev
+php_ev_fe.c		Function entries and their ARGINFO
+php_ev_fe.h		The extention API function prototypes.
+php_ev_pe.c		Property entries & their read and write handlers
+php_ev_priv.h	Extension's private stuff -- typedefs, marcos, prototypes etc.
+php_ev_macros.h	Macros
+php_ev_types.h	Typedefs
+
+
+Global functions
+================
+
+EvLoop ev_default_loop();
+Returns object representing default loop.
+Attention! This is a factory method, which is described in `Using Factory
+Methods', Advanced_php_programming.George Schlossnagle, p.562
+
+EvLoop ev_loop_new([int $flags = EVLAG_AUTO[, $data = NULL[, double $io_collect_interval = 0.[, double
+$timeout_collect_interval = 0.]]]]);
+Calls the same function as EvLoop::__construct internally. See
+EvLoop::__construct below.
+
+The following functions do just the same as libev's counterparts:
+* void ev_sleep(double $interval);
+* double ev_time();
+* double ev_now();
+* void ev_verify(EvLoop $loop);
+* void ev_now_update(EvLoop $loop);
+* void ev_suspend(EvLoop $loop);
+* void ev_run(EvLoop $loop[, int $flags = 0])
+* void ev_break(EvLoop $loop[, int $how = EVBREAK_ONE]);
+* void ev_ref(EvLoop $loop);
+* void ev_unref(EvLoop $loop);
+* string ev_version_major();
+* string ev_version_minor();
+* int ev_supported_backends();
+* int ev_recommended_backends();
+* int ev_embeddable_backends();
+* void ev_feed_signal(int $signum);
+* void ev_invoke_pending(EvLoop $loop);
+* int ev_backend(EvLoop $loop);
+* int ev_pending_count(EvLoop $loop);
+* int ev_depth(EvLoop $loop);
+* int ev_is_default_loop(EvLoop $loop);
+* int ev_iteration(EvLoop $loop);
+
+Watcher functions:
+* void ev_watcher_start(EvWatcher $w);
+* void ev_watcher_stop(EvWatcher $w);
+	are mapped to EvWatcher::start() and EvWatcher::stop() methods
+* bool ev_watcher_is_active(EvWatcher $w);
+	is mapped to EvWatcher::$is_active property
+* bool ev_watcher_is_pending(EvWatcher $w);
+	is mapped to EvWatcher::$is_pending property
+* mixed ev_watcher_get_data(EvWatcher $w);
+* void ev_watcher_set_data(EvWatcher $w, mixed $data);
+	do the same as get- and set- internal functions restrieving EvWatcher::$data
+	property value.
+* void ev_watcher_invoke(EvWatcher $w, int revents)
+	Does the same as EvWatcher::invoke()
+* int ev_watcher_clear_pending();
+	Does the same as EvWatcher::clear()
+* void ev_watcher_feed_event(EvWatcher $w, int revents);
+	Does the same as EvWatcher::feed()
+* callback ev_watcher_get_callback(EvWatcher $w);
+* void ev_watcher_set_callback(EvWatcher $w, callback $callback);
+	are mapped to EvWatcher::$callback property
+* int ev_watcher_get_priority(EvWatcher $w); 
+* void ev_watcher_set_priority(EvWatcher $w, int $priority);
+	are mapped to EvWatcher::$priority property
+
+
+* EvIO ev_watcher_io(resource $fd, int $events, callback $callback[, mixed $data =
+NULL[, int $priority = 0]])
+	Mapped to EvIO::__construct()
+* void ev_watcher_io_set(resource $fd, int events);
+	Mapped to EvIO::set()
+* resource ev_watcher_io_fd_get(EvIO $w);
+	mapped to EvIO::$fd property
+* int ev_watcher_io_events_get(EvIO $w);
+	mapped to EvIO::$events property
+
+* EvTimer ev_watcher_timer(double $after, double $repeat, EvLoop $loop, callback
+$callback [, $data = NULL[, int $priority = 0]]);
+	Mapped to EvTimer::__construct()
+* void ev_watcher_timer_set(double $after, double $repeat);
+	Mapped to EvTimer::set()
+* void ev_watcher_timer_again(EvTimer $w);
+	Mapped to EvTimer::again()
+* double ev_watcher_timer_remaining(EvTimer $w);
+	Mapped to EvTimer::remaining()
+
+* EvPeriodic ev_watcher_periodic(double $offset, double $interval, EvLoop $loop[, mixed
+$data[, int $priority = 0]]);
+	Mapped to EvPeriodic::__construct()
+* void ev_watcher_periodic_set(EvPeriodic $w, double $offset, double $interval);
+	Mapped to EvPeriodic::set()
+* void ev_watcher_periodic_again(EvPeriodic $w);
+* double ev_watcher_periodic_at(EvPeriodic $w);
+
+
+* EvScheduler ev_watcher_schedule(callback $scheduler, EvLoop $loop, callback $callback[, mixed
+$data = NULL[, int $priority = 0]]);
+	Mapped to EvScheduler::__construct()
+* void ev_watcher_scheduler_set(EvScheduler $w, double $offset, double $interval);
+	Mapped to EvScheduler::set()
+* void ev_watcher_scheduler_again(EvScheduler $w);
+* double ev_watcher_scheduler(EvScheduler $w);
+
+
+* EvSignal ev_watcher_signal(int $signum, EvLoop $loop, callback $callback[, mixed $data = NULL[,
+	Mapped to EvSignal::__construct()
+* void ev_watcher_signal_set(EvSignal $w, int $signum);
+	Mapped to EvSignal::set()
+* ev_watcher_signal_set(EvSignal $w, int $signum);
+* ev_watcher_signal_get(EvSignal $w);
+	Mapped to EvSignal::$signum property
+
+...........
+
+Classes
+=======
+
+* EvLoop
+* EvException
+
+Watcher classes:
+
+* EvWatcher - base class for the rest of watcher classes
+* EvTimer
+* EvIO
+* EvTimer
+* EvPeriodic
+* EvScheduler
+* EvSignal
+* EvChild
+* EvStat
+* EvIdle
+* EvPrepare
+* EvCheck
+* EvEmbed
+* EvFork
+* EvAsync
+
+
+EvLoop
+======
+
+
+EvLoop Properties:
+------------------
+
+public $data = NULL;
+Internal property get- and set- functions call 
+ev_set_userdata(loop, data) and ev_userdata(loop).
+Is set in EvLoop::__construct as well.
+
+protected int $backend;
+is mapped from ev_backend();
+
+protected int $pending;
+is mapped from ev_pending_count();
+
+protected int $depth;
+is mapped from ev_depth();
+
+protected int $is_default_loop;
+is mapped from ev_is_default_loop();
+
+protected int $iteration; 
+is mapped from ev_iteration();
+
+EvLoop Methods:
+---------------
+(DONE) __construct([int $flags = EVLAG_AUTO[, $callback = NULL[, $data = NULL[, double $io_collect_interval = 0.[, double
+$timeout_collect_interval = 0.]]]]]);
+- $data is a variable attached to the event loop object.
+- When $io_collect_interval, or $timeout_collect_interval are greater than zero,
+	ev_io_collect_interval(), or ev_timeout_collect_interval() libev functions
+	will be called internally.
+- If omitted or NULL, the loop will fall back to its default behaviour of calling
+	ev_invoke_pending() when required. If it is a callable, then the loop will
+	execute it instead, and it becomes the user's responsibility to call
+	EvLoop::invoke_pending(), or ev_invoke_pending() to invoke pending events.
+	The callback must match the following prototype:
+		void callback(EvLoop $loop);
+
+
+EvLoop ev_default_loop([int $flags = EVLAG_AUTO]);
+is mapped from ev_default_loop
+
+(DONE) void loop_fork();
+
+(DONE) void verify();
+is mapped from ev_verify();
+
+(DONE) void invoke_pending();
+
+(DONE) void now_update();
+(DONE) void suspend();
+(DONE) void resume();
+
+(DONE) int supported_backends();
+(DONE) int recommended_backends();
+(DONE) int embeddable_backends();
+are mapped from their ev_* counterparts.
+
+(DONE) void sleep(double $seconds);
+calls ev_sleep().
+
+(DONE) double time();
+(DONE) double now();
+
+(DONE) void run([int $flags = 0]);
+(DONE) void break([int $flags = 0]);
+(DONE) void feed_signal(int $signum);
+are mapped from their ev_*() counterparts.
+(DONE) void feed_signal_event(int $signum);
+
+
+EvWatcher
+=========
+
+EvWatcher is the base class for all watcher classes.
+
+EvWatcher Properties 
+--------------------
+
+(DONE) protected bool $is_active;
+mapped from ev_watcher_is_active;
+
+(DONE) protected bool $is_pending;
+mapped from ev_watcher_is_pending;
+
+(DONE) public int $priority;
+Calls ev_priority() and ev_set_priority() internally to get and set the watcher
+priority. Mapped from ev_watcher_get_priority() and ev_watcher_set_priority().
+
+public callback $callback;
+calls ev_cb() internally. Mapped from ev_watcher_callback.
+callback must match the following prorotype: 
+	void function callback(EvWatcher $w, int revents);
+	$w should be a subclass of EvWatcher
+
+public mixed $data;
+Internal get- and set- functions retrieve corresponding field of custom watcher
+structure. See
+http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#ASSOCIATING_CUSTOM_DATA_WITH_A_WATCH
+
+
+EvWatcher Methods
+-----------------
+
+void start(void);
+mapped from ev_watcher_start
+
+void stop(void);
+mapped from ev_watcher_stop
+
+void invoke(int $revents);
+Invoke the watcher callback with the given revents. Calls ev_invoke()
+internally. 
+
+int clear(int revents);
+Calls ev_clear_pending() internally.
+
+void feed(int revents);
+Calls ev_feed_event() internally. 
+
+
+EvIO
+====
+
+EvIO is a class derived from EvWatcher. Represents libev's IO watcher.
+
+Properties:
+
+protected resource $fd;
+protected int $events;
+
+
+Methods:
+
+public __construct(resource $fd, int $events, callback $callback[, mixed $data =
+NULL[, int $priority = 0]]);
+
+public set(resource $fd, events);
+Reconfigures the watcher, see the constructor above for details. Can be called
+at any time.
+
+
+EvTimer
+=======
+
+Methods: 
+
+EvTimer __construct(double $after, double $repeat, EvLoop $loop, callback
+$callback [, $data = NULL[, int $priority = 0]]);
+
+void set(double $after, double $repeat);
+Reconfigures the watcher, see the constructor above for details. Can be called
+at any time.
+
+void again();
+Calls ev_timer_again() internally
+
+double remaining();
+Calls ev_timer_remaining() internally 
+
+
+EvPeriodic
+==========
+
+Properties:
+
+Methods: 
+
+EvPeriodic __construct(double $offset, double $interval, EvLoop $loop[, mixed
+$data[, int $priority = 0]]);
+
+set(double $offset, double $interval);
+Reconfigures the watcher, see the constructor above for details. Can be called at
+any time.
+
+void again();
+Calls ev_periodic_again() internally.
+
+double at();
+Calls ev_periodic_at() internally.
+
+
+EvScheduler
+===========
+
+EvScheduler is a special type of EvPeriodic watchers. It allows to reschedule
+time the watcher will be scheduled next time via callback.
+
+Methods: 
+
+__construct(callback $scheduler, EvLoop $loop, callback $callback[, mixed
+$data = NULL[, int $priority = 0]]);
+$scheduler - rescheduler callback. Must match the following proto:
+	function scheduler(EvScheduler $watcher, double $now);
+
+
+set(double $offset, double $interval);
+Reconfigures the watcher, see the constructor above for details. Can be called at
+any time.
+
+void again();
+Mapped to EvPeriodic::again()
+
+double at();
+Mapped to EvPeriodic::at()
+
+
+EvSignal
+========
+
+Properties:
+
+public int $signum;
+
+Methods: 
+
+EvSignal __construct(int $signum, EvLoop $loop, callback $callback[, mixed $data = NULL[,
+$priority = 0]]);
+
+void set(int $signum);
+calls ev_signal_set() internally
+
+
+EvChild
+=======
+
+Properties: 
+
+protected int $pid; 
+protected int $rpid; 
+protected int $rstatus; 
+
+Methods:
+
+EvChild::__construct(int $pid, bool $trace, EvLoop $loop, callback $callback[,
+mixed $data = NULL[, int priority = 0]]);
+
+voi set(int $pid, bool $trace);
+Reconfigures the watcher, see the constructor above for details. Can be called
+at any time.
+
+
+EvStat
+======
+
+Properties: 
+
+protected string $path;
+protected int $interval;
+
+Methods:
+
+__construct(string $path, double $interval, EvLoop $loop, callback $callback[,
+mixed $data = NULL[, int $priority = 0]]);
+
+void set($string $path, double $interval);
+Reconfigures the watcher, see the constructor above for details. Can be called
+at any time.
+
+
+.................
+
+
+
+
+vim: ts=4 sts=4 sw=4 tw=80
+-------------------------------------------------------------------- 
+                  The PHP License, version 3.01
+Copyright (c) 1999 - 2012 The PHP Group. All rights reserved.
+-------------------------------------------------------------------- 
+
+Redistribution and use in source and binary forms, with or without
+modification, is permitted provided that the following conditions
+are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+ 
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in
+     the documentation and/or other materials provided with the
+     distribution.
+ 
+  3. The name "PHP" must not be used to endorse or promote products
+     derived from this software without prior written permission. For
+     written permission, please contact group@php.net.
+  
+  4. Products derived from this software may not be called "PHP", nor
+     may "PHP" appear in their name, without prior written permission
+     from group@php.net.  You may indicate that your software works in
+     conjunction with PHP by saying "Foo for PHP" instead of calling
+     it "PHP Foo" or "phpfoo"
+ 
+  5. The PHP Group may publish revised and/or new versions of the
+     license from time to time. Each version will be given a
+     distinguishing version number.
+     Once covered code has been published under a particular version
+     of the license, you may always continue to use it under the terms
+     of that version. You may also choose to use such covered code
+     under the terms of any subsequent version of the license
+     published by the PHP Group. No one other than the PHP Group has
+     the right to modify the terms applicable to covered code created
+     under this License.
+
+  6. Redistributions of any form whatsoever must retain the following
+     acknowledgment:
+     "This product includes PHP software, freely available from
+     <http://www.php.net/software/>".
+
+THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND 
+ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
+PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PHP
+DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+-------------------------------------------------------------------- 
+
+This software consists of voluntary contributions made by many
+individuals on behalf of the PHP Group.
+
+The PHP Group can be contacted via Email at group@php.net.
+
+For more information on the PHP Group and the PHP project, 
+please see <http://www.php.net>.
+
+PHP includes the Zend Engine, freely available at
+<http://www.zend.com>.
+
+Ev - PECL extension
+
+DESCRIPTION
+===========
+
+Ev is a PECL extension providing inteface to libev library - high performance
+full-featured event loop written in C.
+
+
+ABOUT LIBEV
+-----------
+
+Libev is an event loop: you register interest in certain events (such as a file
+descriptor being readable or a timeout occurring), and it will manage these
+event sources and provide your program with events.
+
+To do this, it must take more or less complete control over your process (or
+thread) by executing the event loop handler, and will then communicate events
+via a callback mechanism.
+
+You register interest in certain events by registering so-called event watchers,
+and then hand it over to libev by starting the watcher.
+
+For details refer to the libev's homepage:
+<http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#EMBEDDING>
+
+For installation instructions see file named INSTALL.
+
+
+LIBEV IS EMBEDDED
+-----------------
+
+You don't need to install libev separately, since it is embedded in this
+extension.
+
+
+PORTABILITY
+-----------
+
+Currently GNU/Linux platforms supported only.
+
+
+AUTHORS
+=======
+
+Ruslan Osmanov <osmanov@php.net>
+
+
+COPYRIGHT
+=========
+
+Copyright (c) 2012 Ruslan Osmanov <osmanov@php.net>
+
+This project is subject to version 3.01 of the PHP license, that is bundled
+with this package in the file LICENSE, and is available through the
+world-wide-web at the following url: http://www.php.net/license/3_01.txt If you
+did not receive a copy of the PHP license and are unable to obtain it through
+the world-wide-web, please send a note to license@php.net so we can mail you a
+copy immediately.
+
+vim: tw=80 ft=markdown
+
+Problem: move the class code separate files, then simply
+========================================================
+
+#include "php_ev_loop.c"
+#include "php_ev_watcher.c"
+#include "php_ev_io.c"
+#include "php_ev_timer.c"
+#if EV_PERIODIC_ENABLE
+#include "php_ev_periodic.c"
+#endif
+#if EV_PREPARE_ENABLE
+#include "php_ev_scheduler.c"
+#endif
+#endif
+#if EV_SIGNAL_ENABLE
+#include "php_ev_signal.c"
+#endif
+#if EV_CHILD_ENABLE
+#include "php_ev_child.c"
+#endif
+#if EV_STAT_ENABLE
+#include "php_ev_stat.c"
+#endif
+#if EV_IDLE_ENABLE
+#include "php_ev_idle.c"
+#endif
+#if EV_PREPARE_ENABLE
+#include "php_ev_prepare.c"
+#endif
+#if EV_CHECK_ENABLE
+#include "php_ev_check.c"
+#endif
+#if EV_EMBED_ENABLE
+#include "php_ev_embed.c"
+#endif
+#if EV_FORK_ENABLE
+#include "php_ev_fork.c"
+#endif
+#if EV_ASYNC_ENABLE
+#include "php_ev_async.c"
+#endif
+
+Somewhere in php_ev.c, or php_ev.h
+
+========================================================
+C++? 
+========================================================
+
+Manipulations with similar watcher types, and the watcher type inheritance
+might be done with C++ classes.  To wrap a C++ class is not difficult. To
+compile libev with CXX is not a problem either.  But do I really need this?
+
+I'll try to cope with pure C, then try to comlipe with C++.  It is also
+possible to compile just some files with CXX, and some with the good old C.
+intl extention has a cpp file and the rest are c and h ones, for instance.
+/*
+   +----------------------------------------------------------------------+
+   | PHP Version 5                                                        |
+   +----------------------------------------------------------------------+
+   | Copyright (c) 1997-2012 The PHP Group                                |
+   +----------------------------------------------------------------------+
+   | This source file is subject to version 3.01 of the PHP license,      |
+   | that is bundled with this package in the file LICENSE, and is        |
+   | available through the world-wide-web at the following url:           |
+   | http://www.php.net/license/3_01.txt                                  |
+   | If you did not receive a copy of the PHP license and are unable to   |
+   | obtain it through the world-wide-web, please send a note to          |
+   | license@php.net so we can mail you a copy immediately.               |
+   +----------------------------------------------------------------------+
+   | Author: Ruslan Osmanov <osmanov@php.net>                             |
+   +----------------------------------------------------------------------+
+*/
+#ifndef PHP_EV_EMBED_H
+#define PHP_EV_EMBED_H
+
+#include "php_ev_common.h"
+#include "php_ev_types.h"
+
+/* EV_STANDALONE isn't needed, since we use libev/libev.m4
+ * #define EV_STANDALONE 1 */
+#undef EV_USE_POLL
+/* We compile multiple source files. So we don't need static API
+ * #define EV_API_STATIC 1 */
+#undef EV_API_STATIC
+
+#define EV_COMPAT3      0
+#define EV_FEATURES     8
+#define EV_MULTIPLICITY 1
+#define EV_USE_POLL     1
+#define EV_CHILD_ENABLE 1
+#define EV_ASYNC_ENABLE 1
+#define EV_MINPRI       -2
+#define EV_MAXPRI       2
+
+#ifdef PHP_EV_DEBUG
+# define EV_VERIFY 2
+#else
+# define EV_VERIFY 0
+#endif
+
+/* Thread context. With it we are getting rid of need 
+ * to call the heavy TSRMLS_FETCH() */
+#ifdef ZTS
+# define PHP_EV_EMBED_THREAD_CTX void ***thread_ctx
+#else
+# define PHP_EV_EMBED_THREAD_CTX
+#endif
+
+/* Override `data` member of the watcher structs.
+ * See php_ev_types.h and libev/ev.h */
+#define EV_COMMON                                                           \
+    zval                       *self;   /* this struct */                   \
+    zval                       *data;   /* custom var attached by user */   \
+    zval                       *loop;                                       \
+    zend_fcall_info            *fci;    /* fci &fcc serve $callback arg */  \
+    zend_fcall_info_cache      *fcc;                                        \
+    int                         type;   /* EV_ *constant from libev/ev.h */ \
+    PHP_EV_EMBED_THREAD_CTX;                                                \
+
+#include "libev/ev.h"
+
+#endif /* PHP_EV_EMBED_H */
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 sts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4 sts=4
+ */

libev/CVS/Entries

+/LICENSE/1.10/Mon Apr  2 20:52:32 2012//
+/Makefile.am/1.9/Wed Dec 21 18:16:08 2011//
+/README/1.21/Fri Mar 30 17:43:55 2012//
+/README.embed/1.29/Sat Nov 24 10:10:26 2007//
+/Symbols.ev/1.14/Tue Jan 11 13:45:28 2011//
+/Symbols.event/1.4/Tue May  8 15:52:13 2012//
+/autogen.sh/1.3/Mon May 30 15:28:54 2011//
+/configure.ac/1.34/Sat Feb  4 19:09:29 2012//
+/ev++.h/1.61/Sun Jun 24 14:30:40 2012//
+/ev.3/1.95/Sat May 26 08:52:09 2012//
+/ev.h/1.169/Wed Apr 18 06:09:29 2012//
+/ev.pod/1.421/Thu Aug  2 11:55:28 2012//
+/ev_epoll.c/1.67/Wed Jun 20 12:39:53 2012//
+/ev_kqueue.c/1.54/Mon Apr  2 18:39:54 2012//
+/ev_poll.c/1.39/Sat Jun  4 05:33:29 2011//
+/ev_port.c/1.28/Sat Jun  4 05:33:29 2011//
+/ev_select.c/1.55/Sat Jun  4 05:33:29 2011//
+/ev_vars.h/1.53/Tue Jul 24 16:28:08 2012//
+/ev_win32.c/1.15/Sun Feb 19 02:03:11 2012//
+/ev_wrap.h/1.37/Sun May  6 13:09:35 2012//
+/event.c/1.52/Mon Apr  2 23:14:41 2012//
+/event.h/1.26/Mon Apr  2 23:15:27 2012//
+/event_compat.h/1.8/Wed Feb 16 08:02:51 2011//
+/import_libevent/1.29/Tue Apr 15 04:34:07 2008//
+/libev.m4/1.15/Sun Feb 20 02:56:23 2011//
+/update_ev_c/1.2/Wed Jan 18 12:13:14 2012//
+/update_ev_wrap/1.6/Sun May  6 13:09:29 2012//
+/update_symbols/1.1/Wed Dec 19 01:59:29 2007//
+/Changes/1.281/Sun Oct 28 13:49:58 2012//
+/ev.c/1.450/Sun Oct 28 13:50:00 2012//
+D

libev/CVS/Repository

+libev
+:pserver:anonymous@cvs.schmorp.de/schmorpforge
+Revision history for libev, a high-performance and full-featured event loop.
+
+TODO: ev_loop_wakeup
+TODO: EV_STANDALONE == NO_HASSEL (do not use clock_gettime in ev_standalone)
+TODO: faq, process a thing in each iteration
+TODO: dbeugging tips, ev_verify, ev_init twice
+TODO: ev_break for immediate exit (EVBREAK_NOW?)
+TODO: ev_feed_child_event
+
+TODO: document the special problem of signals around fork.
+TODO: store pid for each signal
+TODO: document file descriptor usage per loop
+TODO: store loop pid_t and compare isndie signal handler,store 1 for same, 2 for differign pid, clean up in loop_fork
+TODO: embed watchers need updating when fd changes
+TODO: document portbaility requirements for atomic pointer access
+        - destroying a non-default loop would stop the global waitpid
+          watcher (Denis Bilenko).
+	- queueing pending watchers of higher priority from a watcher now invokes
+          them in a timely fashion (reported by Denis Bilenko).
+	- add throw() to all libev functions that cannot throw exceptions, for
+          further code size decrease when compiling for C++.
+        - add throw () to callbacks that must not throw exceptions (allocator,
+          syserr, loop acquire/release, periodic reschedule cbs).
+	- fix event_base_loop return code, add event_get_callback, event_base_new,
+          event_base_get_method calls to improve libevent 1.x emulation and add
+          some libevent 2.x functionality (based on a patch by Jeff Davey).
+        - add more memory fences to fix a bug reported by Jeff Davey. Better
+          be overfenced than underprotected.
+	- ev_run now returns a boolean status (true meaning watchers are
+          still active).
+	- ev_once: undef EV_ERROR in ev_kqueue.c, to avoid clashing with
+          libev's EV_ERROR (reported by 191919).
+	- (ecb) add memory fence support for xlC (Darin McBride).
+	- (ecb) add memory fence support for gcc-mips (Anton Kirilov).
+	- (ecb) add memory fence support for gcc-alpha (Christian Weisgerber).
+        - work around some kernels losing file descriptors by leaking
+          the kqueue descriptor in the child.
+        - include sys/syscall.h instead of plain syscall.h.
+        - check for io watcher loops in ev_verify, check for the most
+          common reported usage bug in ev_io_start.
+        - chose socket vs. WSASocket at compiletime using EV_USE_WSASOCKET.
+        - always use WSASend/WSARecv directly on windows, hoping that this
+          works in all cases (unlike read/write/send/recv...).
+        - try to detect signals around a fork faster (test program by
+          Denis Bilenko).
+        - work around recent glibc versions that leak memory in realloc.
+        - rename ev::embed::set to ev::embed::set_embed to avoid clashing
+          the watcher base set (loop) method.
+        - rewrite the async/signal pipe logic to always keep a valid fd, which
+          simplifies (and hopefuly correctifies :) the race checking
+          on fork, at the cost of one extra fd.
+
+4.11 Sat Feb  4 19:52:39 CET 2012
+	- INCOMPATIBLE CHANGE: ev_timer_again now clears the pending status, as
+          was documented already, but not implemented in the repeating case.
+        - new compiletime symbols: EV_NO_SMP and EV_NO_THREADS.
+	- fix a race where the workaround against the epoll fork bugs
+          caused signals to not be handled anymore.
+	- correct backend_fudge for most backends, and implement a windows
+          specific workaround to avoid looping because we call both
+          select and Sleep, both with different time resolutions.
+        - document range and guarantees of ev_sleep.
+        - document reasonable ranges for periodics interval and offset.
+        - rename backend_fudge to backend_mintime to avoid future confusion :)
+	- change the default periodic reschedule function to hopefully be more
+          exact and correct even in corner cases or in the far future.
+        - do not rely on -lm anymore: use it when available but use our
+          own floor () if it is missing. This should make it easier to embed,
+          as no external libraries are required.
+        - strategically import macros from libecb and mark rarely-used functions
+          as cache-cold (saving almost 2k code size on typical amd64 setups).
+        - add Symbols.ev and Symbols.event files, that were missing.
+        - fix backend_mintime value for epoll (was 1/1024, is 1/1000 now).
+        - fix #3 "be smart about timeouts" to not "deadlock" when
+          timeout == now, also improve the section overall.
+        - avoid "AVOIDING FINISHING BEFORE RETURNING" idiom.
+        - support new EV_API_STATIC mode to make all libev symbols
+          static.
+        - supply default CFLAGS of -g -O3 with gcc when original CFLAGS
+          were empty.
+
+4.04 Wed Feb 16 09:01:51 CET 2011
+	- fix two problems in the native win32 backend, where reuse of fd's
+          with different underlying handles caused handles not to be removed
+          or added to the select set (analyzed and tested by Bert Belder).
+	- do no rely on ceil() in ev_e?poll.c.
+        - backport libev to HP-UX versions before 11 v3.
+        - configure did not detect nanosleep and clock_gettime properly when
+          they are available in the libc (as opposed to -lrt).
+
+4.03 Tue Jan 11 14:37:25 CET 2011
+	- officially support polling files with all backends.
+	- support files, /dev/zero etc. the same way as select in the epoll
+          backend, by generating events on our own.
+        - ports backend: work around solaris bug 6874410 and many related ones
+          (EINTR, maybe more), with no performance loss (note that the solaris
+          bug report is actually wrong, reality is far more bizarre and broken
+          than that).
+	- define EV_READ/EV_WRITE as macros in event.h, as some programs use
+          #ifdef to test for them.
+        - new (experimental) function: ev_feed_signal.
+        - new (to become default) EVFLAG_NOSIGMASK flag.
+        - new EVBACKEND_MASK symbol.
+        - updated COMMON IDIOMS SECTION.
+
+4.01 Fri Nov  5 21:51:29 CET 2010
+        - automake fucked it up, apparently, --add-missing -f is not quite enough
+          to make it update its files, so 4.00 didn't install ev++.h and
+          event.h on make install. grrr.
+        - ev_loop(count|depth) didn't return anything (Robin Haberkorn).
+        - change EV_UNDEF to 0xffffffff to silence some overzealous compilers.
+        - use "(libev) " prefix for all libev error messages now.
+
+4.00 Mon Oct 25 12:32:12 CEST 2010
+	- "PORTING FROM LIBEV 3.X TO 4.X" (in ev.pod) is recommended reading.
+	- ev_embed_stop did not correctly stop the watcher (very good
+          testcase by Vladimir Timofeev).
+        - ev_run will now always update the current loop time - it erroneously
+          didn't when idle watchers were active, causing timers not to fire.
+        - fix a bug where a timeout of zero caused the timer not to fire
+          in the libevent emulation (testcase by Péter Szabó).
+	- applied win32 fixes by Michael Lenaghan (also James Mansion).
+	- replace EV_MINIMAL by EV_FEATURES.
+        - prefer EPOLL_CTL_ADD over EPOLL_CTL_MOD in some more cases, as it
+          seems the former is *much* faster than the latter.
+        - linux kernel version detection (for inotify bug workarounds)
+          did not work properly.
+        - reduce the number of spurious wake-ups with the ports backend.
+        - remove dependency on sys/queue.h on freebsd (patch by Vanilla Hsu).
+        - do async init within ev_async_start, not ev_async_set, which avoids
+          an API quirk where the set function must be called in the C++ API
+          even when there is nothing to set.
+        - add (undocumented) EV_ENABLE when adding events with kqueue,
+          this might help with OS X, which seems to need it despite documenting
+          not to need it (helpfully pointed out by Tilghman Lesher).
+        - do not use poll by default on freebsd, it's broken (what isn't
+          on freebsd...).
+        - allow to embed epoll on kernels >= 2.6.32.
+        - configure now prepends -O3, not appends it, so one can still
+          override it.
+        - ev.pod: greatly expanded the portability section, added a porting
+          section, a description of watcher states and made lots of minor fixes.
+        - disable poll backend on AIX, the poll header spams the namespace
+          and it's not worth working around dead platforms (reported
+          and analyzed by Aivars Kalvans).
+        - improve header file compatibility of the standalone eventfd code
+          in an obscure case.
+        - implement EV_AVOID_STDIO option.
+        - do not use sscanf to parse linux version number (smaller, faster,
+          no sscanf dependency).
+        - new EV_CHILD_ENABLE and EV_SIGNAL_ENABLE configurable settings.
+        - update libev.m4 HAVE_CLOCK_SYSCALL test for newer glibcs.
+        - add section on accept() problems to the manpage.
+        - rename EV_TIMEOUT to EV_TIMER.
+        - rename ev_loop_count/depth/verify/loop/unloop.
+        - remove ev_default_destroy and ev_default_fork.
+        - switch to two-digit minor version.
+        - work around an apparent gentoo compiler bug.
+        - define _DARWIN_UNLIMITED_SELECT. just so.
+        - use enum instead of #define for most constants.
+        - improve compatibility to older C++ compilers.
+        - (experimental) ev_run/ev_default_loop/ev_break/ev_loop_new have now
+          default arguments when compiled as C++.
+        - enable automake dependency tracking.
+        - ev_loop_new no longer leaks memory when loop creation failed.
+        - new ev_cleanup watcher type.
+
+3.9  Thu Dec 31 07:59:59 CET 2009
+	- signalfd is no longer used by default and has to be requested
+          explicitly - this means that easy to catch bugs become hard to
+          catch race conditions, but the users have spoken.
+        - point out the unspecified signal mask in the documentation, and
+          that this is a race condition regardless of EV_SIGNALFD.
+	- backport inotify code to C89.
+        - inotify file descriptors could leak into child processes.
+        - ev_stat watchers could keep an erroneous extra ref on the loop,
+          preventing exit when unregistering all watchers (testcases
+          provided by ry@tinyclouds.org).
+        - implement EV_WIN32_HANDLE_TO_FD and EV_WIN32_CLOSE_FD configuration
+          symbols to make it easier for apps to do their own fd management.
+        - support EV_IDLE_ENABLE being disabled in ev++.h
+          (patch by Didier Spezia).
+        - take advantage of inotify_init1, if available, to set cloexec/nonblock
+          on fd creation, to avoid races.
+        - the signal handling pipe wasn't always initialised under windows
+          (analysed by lekma).
+        - changed minimum glibc requirement from glibc 2.9 to 2.7, for
+          signalfd.
+        - add missing string.h include (Denis F. Latypoff).
+        - only replace ev_stat.prev when we detect an actual difference,
+          so prev is (almost) always different to attr. this might
+          have caused the problems with 04_stat.t.
+        - add ev::timer->remaining () method to C++ API.
+
+3.8  Sun Aug  9 14:30:45 CEST 2009
+	- incompatible change: do not necessarily reset signal handler
+          to SIG_DFL when a sighandler is stopped.
+        - ev_default_destroy did not properly free or zero some members,
+          potentially causing crashes and memory corruption on repeated
+          ev_default_destroy/ev_default_loop calls.
+	- take advantage of signalfd on GNU/Linux systems.
+	- document that the signal mask might be in an unspecified
+          state when using libev's signal handling.
+        - take advantage of some GNU/Linux calls to set cloexec/nonblock
+          on fd creation, to avoid race conditions.
+
+3.7  Fri Jul 17 16:36:32 CEST 2009
+	- ev_unloop and ev_loop wrongly used a global variable to exit loops,
+          instead of using a per-loop variable (bug caught by accident...).
+	- the ev_set_io_collect_interval interpretation has changed.
+        - add new functionality: ev_set_userdata, ev_userdata,
+          ev_set_invoke_pending_cb, ev_set_loop_release_cb,
+          ev_invoke_pending, ev_pending_count, together with a long example
+          about thread locking.
+        - add ev_timer_remaining (as requested by Denis F. Latypoff).
+        - add ev_loop_depth.
+        - calling ev_unloop in fork/prepare watchers will no longer poll
+          for new events.
+	- Denis F. Latypoff corrected many typos in example code snippets.
+        - honor autoconf detection of EV_USE_CLOCK_SYSCALL, also double-
+          check that the syscall number is available before trying to
+          use it (reported by ry@tinyclouds).
+        - use GetSystemTimeAsFileTime instead of _timeb on windows, for
+          slightly higher accuracy.
+        - properly declare ev_loop_verify and ev_now_update even when
+          !EV_MULTIPLICITY.
+        - do not compile in any priority code when EV_MAXPRI == EV_MINPRI.
+        - support EV_MINIMAL==2 for a reduced API.
+        - actually 0-initialise struct sigaction when installing signals.
+        - add section on hibernate and stopped processes to ev_timer docs.
+
+3.6  Tue Apr 28 02:49:30 CEST 2009
+	- multiple timers becoming ready within an event loop iteration
+          will be invoked in the "correct" order now.
+	- do not leave the event loop early just because we have no active
+          watchers, fixing a problem when embedding a kqueue loop
+          that has active kernel events but no registered watchers
+          (reported by blacksand blacksand).
+	- correctly zero the idx values for arrays, so destroying and
+          reinitialising the default loop actually works (patch by
+          Malek Hadj-Ali).
+        - implement ev_suspend and ev_resume.
+        - new EV_CUSTOM revents flag for use by applications.
+        - add documentation section about priorities.
+        - add a glossary to the dcoumentation.
+        - extend the ev_fork description slightly.
+        - optimize a jump out of call_pending.
+
+3.53 Sun Feb 15 02:38:20 CET 2009
+	- fix a bug in event pipe creation on win32 that would cause a
+          failed assertion on event loop creation (patch by Malek Hadj-Ali).
+	- probe for CLOCK_REALTIME support at runtime as well and fall
+          back to gettimeofday if there is an error, to support older
+          operating systems with newer header files/libraries.
+        - prefer gettimeofday over clock_gettime with USE_CLOCK_SYSCALL
+          (default most everywhere), otherwise not.
+
+3.52 Wed Jan  7 21:43:02 CET 2009
+	- fix compilation of select backend in fd_set mode when NFDBITS is
+          missing (to get it to compile on QNX, reported by Rodrigo Campos).
+        - better select-nfds handling when select backend is in fd_set mode.
+        - diagnose fd_set overruns when select backend is in fd_set mode.
+        - due to a thinko, instead of disabling everything but
+          select on the borked OS X platform, everything but select was
+          allowed (reported by Emanuele Giaquinta).
+        - actually verify that local and remote port are matching in
+          libev's socketpair emulation, which makes denial-of-service
+          attacks harder (but not impossible - it's windows). Make sure
+          it even works under vista, which thinks that getpeer/sockname
+          should return fantasy port numbers.
+        - include "libev" in all assertion messages for potentially
+          clearer diagnostics.
+        - event_get_version (libevent compatibility) returned
+          a useless string instead of the expected version string
+          (patch by W.C.A. Wijngaards).
+
+3.51 Wed Dec 24 23:00:11 CET 2008
+        - fix a bug where an inotify watcher was added twice, causing
+          freezes on hash collisions (reported and analysed by Graham Leggett).
+	- new config symbol, EV_USE_CLOCK_SYSCALL, to make libev use
+          a direct syscall - slower, but no dependency on librt et al.
+        - assume negative return values != -1 signals success of port_getn
+          (http://cvs.epicsol.org/cgi/viewcvs.cgi/epic5/source/newio.c?rev=1.52)
+          (no known failure reports, but it doesn't hurt).
+        - fork detection in ev_embed now stops and restarts the watcher
+          automatically.
+        - EXPERIMENTAL: default the method to operator () in ev++.h,
+          to make it nicer to use functors (requested by Benedek László).
+        - fixed const object callbacks in ev++.h.
+        - replaced loop_ref argument of watcher.set (loop) by a direct
+          ev_loop * in ev++.h, to avoid clashes with functor patch.
+        - do not try to watch the empty string via inotify.
+        - inotify watchers could be leaked under certain circumstances.
+        - OS X 10.5 is actually even more broken than earlier versions,
+          so fall back to select on that piece of garbage.
+        - fixed some weirdness in the ev_embed documentation.
+
+3.49 Wed Nov 19 11:26:53 CET 2008
+	- ev_stat watchers will now use inotify as a mere hint on
+          kernels <2.6.25, or if the filesystem is not in the
+          "known to be good" list.
+        - better mingw32 compatibility (it's not as borked as native win32)
+          (analysed by Roger Pack).
+        - include stdio.h in the example program, as too many people are
+          confused by the weird C language otherwise. I guess the next thing
+          I get told is that the "..." ellipses in the examples don't compile
+          with their C compiler.
+
+3.48 Thu Oct 30 09:02:37 CET 2008
+	- further optimise away the EPOLL_CTL_ADD/MOD combo in the epoll
+          backend by assuming the kernel event mask hasn't changed if
+          ADD fails with EEXIST.
+        - work around spurious event notification bugs in epoll by using
+          a 32-bit generation counter. recreate kernel state if we receive
+          spurious notifications or unwanted events. this is very costly,
+          but I didn't come up with this horrible design.
+        - use memset to initialise most arrays now and do away with the
+          init functions.
+        - expand time-out strategies into a "Be smart about timeouts" section.
+        - drop the "struct" from all ev_watcher declarations in the
+          documentation and did other clarifications (yeah, it was a mistake
+          to have a struct AND a function called ev_loop).
+	- fix a bug where ev_default would not initialise the default
+          loop again after it was destroyed with ev_default_destroy.
+        - rename syserr to ev_syserr to avoid name clashes when embedding,
+          do similar changes for event.c.
+
+3.45 Tue Oct 21 21:59:26 CEST 2008
+	- disable inotify usage on linux <2.6.25, as it is broken
+          (reported by Yoann Vandoorselaere).
+        - ev_stat erroneously would try to add inotify watchers
+          even when inotify wasn't available (this should only
+          have a performance impact).
+	- ev_once now passes both timeout and io to the callback if both
+          occur concurrently, instead of giving timeouts precedence.
+	- disable EV_USE_INOTIFY when sys/inotify.h is too old.
+
+3.44 Mon Sep 29 05:18:39 CEST 2008
+	- embed watchers now automatically invoke ev_loop_fork on the
+          embedded loop when the parent loop forks.
+	- new function: ev_now_update (loop).
+	- verify_watcher was not marked static.
+        - improve the "associating..." manpage section.
+        - documentation tweaks here and there.
+
+3.43 Sun Jul  6 05:34:41 CEST 2008
+	- include more include files on windows to get struct _stati64
+          (reported by Chris Hulbert, but doesn't quite fix his issue).
+	- add missing #include <io.h> in ev.c on windows (reported by
+          Matt Tolton).
+
+3.42 Tue Jun 17 12:12:07 CEST 2008
+	- work around yet another windows bug: FD_SET actually adds fd's
+          multiple times to the fd_*SET*, despite official MSN docs claiming
+          otherwise. Reported and well-analysed by Matt Tolton.
+	- define NFDBITS to 0 when EV_SELECT_IS_WINSOCKET to make it compile
+          (reported any analysed by Chris Hulbert).
+        - fix a bug in ev_ebadf (this function is only used to catch
+          programming errors in the libev user). reported by Matt Tolton.
+        - fix a bug in fd_intern on win32 (could lead to compile errors
+          under some circumstances, but would work correctly if it compiles).
+          reported by Matt Tolton.
+        - (try to) work around missing lstat on windows.
+	- pass in the write fd set as except fd set under windows. windows
+          is so uncontrollably lame that it requires this. this means that
+          switching off oobinline is not supported (but tcp/ip doesn't
+          have oob, so that would be stupid anyways.
+        - use posix module symbol to auto-detect monotonic clock presence
+          and some other default values.
+
+3.41 Fri May 23 18:42:54 CEST 2008
+	- work around an obscure bug in winsocket select: if you
+          provide only empty fd sets then select returns WSAEINVAL. how sucky.
+        - improve timer scheduling stability and reduce use of time_epsilon.
+        - use 1-based 2-heap for EV_MINIMAL, simplifies code, reduces
+          codesize and makes for better cache-efficiency.
+        - use 3-based 4-heap for !EV_MINIMAL. this makes better use
+          of cpu cache lines and gives better growth behaviour than
+          2-based heaps.
+        - cache timestamp within heap for !EV_MINIMAL, to avoid random
+          memory accesses.
+        - document/add EV_USE_4HEAP and EV_HEAP_CACHE_AT.
+        - fix a potential aliasing issue in ev_timer_again.
+        - add/document ev_periodic_at, retract direct access to ->at.
+        - improve ev_stat docs.
+        - add portability requirements section.
+	- fix manpage headers etc.
+        - normalise WSA error codes to lower range on windows.
+        - add consistency check code that can be called automatically
+          or on demand to check for internal structures (ev_loop_verify).
+
+3.31 Wed Apr 16 20:45:04 CEST 2008
+	- added last minute fix for ev_poll.c by Brandon Black.
+
+3.3  Wed Apr 16 19:04:10 CEST 2008
+        - event_base_loopexit should return 0 on success
+          (W.C.A. Wijngaards).
+	- added linux eventfd support.
+        - try to autodetect epoll and inotify support
+          by libc header version if not using autoconf.
+        - new symbols: EV_DEFAULT_UC and EV_DEFAULT_UC_.
+        - declare functions defined in ev.h as inline if
+          C99 or gcc are available.
+        - enable inlining with gcc versions 2 and 3.
+        - work around broken poll implementations potentially
+          not clearing revents field in ev_poll (Brandon Black)
+          (no such systems are known at this time).
+        - work around a bug in realloc on openbsd and darwin,
+          also makes the erroneous valgrind complaints
+          go away (noted by various people).
+        - fix ev_async_pending, add c++ wrapper for ev_async
+          (based on patch sent by Johannes Deisenhofer).
+        - add sensible set method to ev::embed.
+        - made integer constants type int in ev.h.
+
+3.2  Wed Apr  2 17:11:19 CEST 2008
+	- fix a 64 bit overflow issue in the select backend,
+          by using fd_mask instead of int for the mask.
+        - rename internal sighandler to avoid clash with very old perls.
+        - entering ev_loop will not clear the ONESHOT or NONBLOCKING
+          flags of any outer loops anymore.
+        - add ev_async_pending.
+
+3.1  Thu Mar 13 13:45:22 CET 2008
+	- implement ev_async watchers.
+        - only initialise signal pipe on demand.
+	- make use of sig_atomic_t configurable.
+        - improved documentation.
+
+3.0  Mon Jan 28 13:14:47 CET 2008
+	- API/ABI bump to version 3.0.
+	- ev++.h includes "ev.h" by default now, not <ev.h>.
+	- slightly improved documentation.
+	- speed up signal detection after a fork.
+        - only optionally return trace status changed in ev_child
+          watchers.
+        - experimental (and undocumented) loop wrappers for ev++.h.
+
+2.01 Tue Dec 25 08:04:41 CET 2007
+	- separate Changes file.
+	- fix ev_path_set => ev_stat_set typo.
+        - remove event_compat.h from the libev tarball.
+        - change how include files are found.
+        - doc updates.
+        - update licenses, explicitly allow for GPL relicensing.
+
+2.0  Sat Dec 22 17:47:03 CET 2007
+        - new ev_sleep, ev_set_(io|timeout)_collect_interval.
+        - removed epoll from embeddable fd set.
+        - fix embed watchers.
+	- renamed ev_embed.loop to other.
+	- added exported Symbol tables.
+        - undefine member wrapper macros at the end of ev.c.
+        - respect EV_H in ev++.h.
+
+1.86 Tue Dec 18 02:36:57 CET 2007
+	- fix memleak on loop destroy (not relevant for perl).
+
+1.85 Fri Dec 14 20:32:40 CET 2007
+        - fix some aliasing issues w.r.t. timers and periodics
+          (not relevant for perl).
+
+(for historic versions refer to EV/Changes, found in the Perl interface)
+
+0.1  Wed Oct 31 21:31:48 CET 2007
+	- original version; hacked together in <24h.
+
+All files in libev are
+Copyright (c)2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Alternatively, the contents of this package may be used under the terms
+of the GNU General Public License ("GPL") version 2 or any later version,
+in which case the provisions of the GPL are applicable instead of the
+above. If you wish to allow the use of your version of this package only
+under the terms of the GPL and not to allow others to use your version of
+this file under the BSD license, indicate your decision by deleting the
+provisions above and replace them with the notice and other provisions
+required by the GPL in this and the other files of this package. If you do
+not delete the provisions above, a recipient may use your version of this
+file under either the BSD or the GPL.
+libev is a high-performance event loop/event model with lots of features.
+(see benchmark at http://libev.schmorp.de/bench.html)
+
+
+ABOUT
+
+   Homepage: http://software.schmorp.de/pkg/libev
+   Mailinglist: libev@lists.schmorp.de
+                http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
+   Library Documentation: http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod
+
+   Libev is modelled (very losely) after libevent and the Event perl
+   module, but is faster, scales better and is more correct, and also more
+   featureful. And also smaller. Yay.
+
+   Some of the specialties of libev not commonly found elsewhere are:
+   
+   - extensive and detailed, readable documentation (not doxygen garbage).
+   - fully supports fork, can detect fork in various ways and automatically
+     re-arms kernel mechanisms that do not support fork.
+   - highly optimised select, poll, epoll, kqueue and event ports backends.
+   - filesystem object (path) watching (with optional linux inotify support).
+   - wallclock-based times (using absolute time, cron-like).
+   - relative timers/timeouts (handle time jumps).
+   - fast intra-thread communication between multiple
+     event loops (with optional fast linux eventfd backend).
+   - extremely easy to embed (fully documented, no dependencies,
+     autoconf supported but optional).
+   - very small codebase, no bloated library, simple code.
+   - fully extensible by being able to plug into the event loop,
+     integrate other event loops, integrate other event loop users.
+   - very little memory use (small watchers, small event loop data).
+   - optional C++ interface allowing method and function callbacks
+     at no extra memory or runtime overhead.
+   - optional Perl interface with similar characteristics (capable
+     of running Glib/Gtk2 on libev).
+   - support for other languages (multiple C++ interfaces, D, Ruby,
+     Python) available from third-parties.
+
+   Examples of programs that embed libev: the EV perl module, node.js,
+   auditd, rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the
+   Deliantra MMORPG server (http://www.deliantra.net/), Rubinius (a
+   next-generation Ruby VM), the Ebb web server, the Rev event toolkit.
+
+
+CONTRIBUTORS
+
+   libev was written and designed by Marc Lehmann and Emanuele Giaquinta.
+
+   The following people sent in patches or made other noteworthy
+   contributions to the design (for minor patches, see the Changes
+   file. If I forgot to include you, please shout at me, it was an
+   accident):
+
+   W.C.A. Wijngaards
+   Christopher Layne
+   Chris Brody
+

libev/README.embed

+This file is now included in the main libev documentation, see
+
+   http://cvs.schmorp.de/libev/ev.html
+ev_async_send
+ev_async_start
+ev_async_stop
+ev_backend
+ev_break
+ev_check_start
+ev_check_stop
+ev_child_start
+ev_child_stop
+ev_cleanup_start
+ev_cleanup_stop
+ev_clear_pending
+ev_default_loop
+ev_default_loop_ptr
+ev_depth
+ev_embed_start
+ev_embed_stop
+ev_embed_sweep
+ev_embeddable_backends
+ev_feed_event
+ev_feed_fd_event
+ev_feed_signal
+ev_feed_signal_event
+ev_fork_start
+ev_fork_stop
+ev_idle_start
+ev_idle_stop
+ev_invoke
+ev_invoke_pending
+ev_io_start
+ev_io_stop
+ev_iteration
+ev_loop_destroy
+ev_loop_fork
+ev_loop_new
+ev_now
+ev_now_update
+ev_once
+ev_pending_count
+ev_periodic_again
+ev_periodic_start
+ev_periodic_stop
+ev_prepare_start
+ev_prepare_stop
+ev_recommended_backends
+ev_ref
+ev_resume
+ev_run
+ev_set_allocator
+ev_set_invoke_pending_cb
+ev_set_io_collect_interval
+ev_set_loop_release_cb
+ev_set_syserr_cb
+ev_set_timeout_collect_interval
+ev_set_userdata
+ev_signal_start
+ev_signal_stop
+ev_sleep
+ev_stat_start
+ev_stat_stat
+ev_stat_stop
+ev_supported_backends
+ev_suspend
+ev_time
+ev_timer_again
+ev_timer_remaining
+ev_timer_start
+ev_timer_stop
+ev_unref
+ev_userdata
+ev_verify
+ev_version_major
+ev_version_minor

libev/Symbols.event

+event_active
+event_add
+event_base_dispatch
+event_base_free
+event_base_get_method
+event_base_loop
+event_base_loopexit
+event_base_new
+event_base_once
+event_base_priority_init
+event_base_set
+event_del
+event_dispatch
+event_get_callback
+event_get_method
+event_get_version
+event_init
+event_loop
+event_loopexit
+event_once
+event_pending
+event_priority_init
+event_priority_set
+event_set
+#!/bin/sh
+
+autoreconf --install --symlink --force

libev/configure.ac

+orig_CFLAGS="$CFLAGS"
+
+AC_INIT
+AC_CONFIG_SRCDIR([ev_epoll.c])
+
+AM_INIT_AUTOMAKE(libev,4.11) dnl also update ev.h!
+AC_CONFIG_HEADERS([config.h])
+AM_MAINTAINER_MODE
+
+AC_PROG_CC
+
+dnl Supply default CFLAGS, if not specified
+if test -z "$orig_CFLAGS"; then
+  if test x$GCC = xyes; then
+    CFLAGS="-g -O3"
+  fi
+fi
+
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+
+m4_include([libev.m4])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+/*
+ * libev simple C++ wrapper classes
+ *
+ * Copyright (c) 2007,2008,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ *   1.  Redistributions of source code must retain the above copyright notice,
+ *       this list of conditions and the following disclaimer.
+ *
+ *   2.  Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
+ * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
+ * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
+ * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
+ * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * the GNU General Public License ("GPL") version 2 or any later version,
+ * in which case the provisions of the GPL are applicable instead of
+ * the above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use your
+ * version of this file under the BSD license, indicate your decision
+ * by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file under
+ * either the BSD or the GPL.
+ */
+
+#ifndef EVPP_H__
+#define EVPP_H__
+
+#ifdef EV_H
+# include EV_H
+#else
+# include "ev.h"
+#endif
+
+#ifndef EV_USE_STDEXCEPT
+# define EV_USE_STDEXCEPT 1
+#endif
+
+#if EV_USE_STDEXCEPT
+# include <stdexcept>
+#endif
+
+namespace ev {
+
+  typedef ev_tstamp tstamp;
+
+  enum {
+    UNDEF    = EV_UNDEF,
+    NONE     = EV_NONE,
+    READ     = EV_READ,
+    WRITE    = EV_WRITE,
+#if EV_COMPAT3
+    TIMEOUT  = EV_TIMEOUT,
+#endif
+    TIMER    = EV_TIMER,
+    PERIODIC = EV_PERIODIC,
+    SIGNAL   = EV_SIGNAL,
+    CHILD    = EV_CHILD,
+    STAT     = EV_STAT,
+    IDLE     = EV_IDLE,
+    CHECK    = EV_CHECK,
+    PREPARE  = EV_PREPARE,
+    FORK     = EV_FORK,
+    ASYNC    = EV_ASYNC,
+    EMBED    = EV_EMBED,
+#   undef ERROR // some systems stupidly #define ERROR
+    ERROR    = EV_ERROR
+  };
+
+  enum
+  {
+    AUTO      = EVFLAG_AUTO,
+    NOENV     = EVFLAG_NOENV,
+    FORKCHECK = EVFLAG_FORKCHECK,
+
+    SELECT    = EVBACKEND_SELECT,
+    POLL      = EVBACKEND_POLL,
+    EPOLL     = EVBACKEND_EPOLL,
+    KQUEUE    = EVBACKEND_KQUEUE,
+    DEVPOLL   = EVBACKEND_DEVPOLL,
+    PORT      = EVBACKEND_PORT
+  };
+
+  enum
+  {
+#if EV_COMPAT3
+    NONBLOCK = EVLOOP_NONBLOCK,
+    ONESHOT  = EVLOOP_ONESHOT,
+#endif
+    NOWAIT   = EVRUN_NOWAIT,
+    ONCE     = EVRUN_ONCE
+  };
+
+  enum how_t
+  {
+    ONE = EVBREAK_ONE,
+    ALL = EVBREAK_ALL
+  };
+
+  struct bad_loop
+#if EV_USE_STDEXCEPT
+  : std::runtime_error
+#endif
+  {
+#if EV_USE_STDEXCEPT
+    bad_loop ()
+    : std::runtime_error ("libev event loop cannot be initialized, bad value of LIBEV_FLAGS?")
+    {
+    }
+#endif
+  };
+
+#ifdef EV_AX
+#  undef EV_AX
+#endif
+
+#ifdef EV_AX_
+#  undef EV_AX_
+#endif
+
+#if EV_MULTIPLICITY
+#  define EV_AX  raw_loop
+#  define EV_AX_ raw_loop,
+#else
+#  define EV_AX
+#  define EV_AX_
+#endif
+
+  struct loop_ref
+  {
+    loop_ref (EV_P) throw ()
+#if EV_MULTIPLICITY
+    : EV_AX (EV_A)
+#endif
+    {
+    }
+
+    bool operator == (const loop_ref &other) const throw ()
+    {
+#if EV_MULTIPLICITY
+      return EV_AX == other.EV_AX;
+#else
+      return true;
+#endif
+    }
+
+    bool operator != (const loop_ref &other) const throw ()
+    {
+#if EV_MULTIPLICITY
+      return ! (*this == other);
+#else
+      return false;
+#endif
+    }
+
+#if EV_MULTIPLICITY
+    bool operator == (const EV_P) const throw ()
+    {
+      return this->EV_AX == EV_A;
+    }
+
+    bool operator != (const EV_P) const throw ()
+    {
+      return (*this == EV_A);
+    }
+
+    operator struct ev_loop * () const throw ()
+    {
+      return EV_AX;
+    }
+
+    operator const struct ev_loop * () const throw ()
+    {
+      return EV_AX;
+    }
+
+    bool is_default () const throw ()
+    {
+      return EV_AX == ev_default_loop (0);
+    }
+#endif
+
+#if EV_COMPAT3
+    void loop (int flags = 0)
+    {
+      ev_run (EV_AX_ flags);
+    }
+
+    void unloop (how_t how = ONE) throw ()
+    {
+      ev_break (EV_AX_ how);
+    }
+#endif
+
+    void run (int flags = 0)
+    {
+      ev_run (EV_AX_ flags);
+    }
+
+    void break_loop (how_t how = ONE) throw ()
+    {
+      ev_break (EV_AX_ how);
+    }
+
+    void post_fork () throw ()
+    {
+      ev_loop_fork (EV_AX);
+    }
+
+    unsigned int backend () const throw ()
+    {
+      return ev_backend (EV_AX);
+    }
+
+    tstamp now () const throw ()
+    {
+      return ev_now (EV_AX);
+    }
+
+    void ref () throw ()
+    {
+      ev_ref (EV_AX);
+    }
+
+    void unref () throw ()
+    {
+      ev_unref (EV_AX);
+    }
+
+#if EV_FEATURE_API
+    unsigned int iteration () const throw ()
+    {
+      return ev_iteration (EV_AX);
+    }
+
+    unsigned int depth () const throw ()
+    {
+      return ev_depth (EV_AX);
+    }
+
+    void set_io_collect_interval (tstamp interval) throw ()
+    {
+      ev_set_io_collect_interval (EV_AX_ interval);
+    }
+
+    void set_timeout_collect_interval (tstamp interval) throw ()
+    {
+      ev_set_timeout_collect_interval (EV_AX_ interval);
+    }
+#endif
+
+    // function callback
+    void once (int fd, int events, tstamp timeout, void (*cb)(int, void *), void *arg = 0) throw ()
+    {
+      ev_once (EV_AX_ fd, events, timeout, cb, arg);
+    }
+
+    // method callback
+    template<class K, void (K::*method)(int)>
+    void once (int fd, int events, tstamp timeout, K *object) throw ()
+    {
+      once (fd, events, timeout, method_thunk<K, method>, object);
+    }
+
+    // default method == operator ()
+    template<class K>
+    void once (int fd, int events, tstamp timeout, K *object) throw ()
+    {
+      once (fd, events, timeout, method_thunk<K, &K::operator ()>, object);
+    }
+
+    template<class K, void (K::*method)(int)>
+    static void method_thunk (int revents, void *arg)
+    {
+      (static_cast<K *>(arg)->*method)
+        (revents);
+    }
+
+    // no-argument method callback
+    template<class K, void (K::*method)()>
+    void once (int fd, int events, tstamp timeout, K *object) throw ()
+    {
+      once (fd, events, timeout, method_noargs_thunk<K, method>, object);
+    }
+
+    template<class K, void (K::*method)()>
+    static void method_noargs_thunk (int revents, void *arg)
+    {
+      (static_cast<K *>(arg)->*method)
+        ();
+    }
+
+    // simpler function callback
+    template<void (*cb)(int)>
+    void once (int fd, int events, tstamp timeout) throw ()
+    {
+      once (fd, events, timeout, simpler_func_thunk<cb>);
+    }
+
+    template<void (*cb)(int)>
+    static void simpler_func_thunk (int revents, void *arg)
+    {
+      (*cb)
+        (revents);
+    }
+
+    // simplest function callback
+    template<void (*cb)()>
+    void once (int fd, int events, tstamp timeout) throw ()
+    {
+      once (fd, events, timeout, simplest_func_thunk<cb>);
+    }
+
+    template<void (*cb)()>
+    static void simplest_func_thunk (int revents, void *arg)
+    {
+      (*cb)
+        ();
+    }
+
+    void feed_fd_event (int fd, int revents) throw ()
+    {
+      ev_feed_fd_event (EV_AX_ fd, revents);
+    }
+
+    void feed_signal_event (int signum) throw ()
+    {
+      ev_feed_signal_event (EV_AX_ signum);
+    }
+
+#if EV_MULTIPLICITY
+    struct ev_loop* EV_AX;
+#endif
+
+  };
+
+#if EV_MULTIPLICITY
+  struct dynamic_loop : loop_ref
+  {
+
+    dynamic_loop (unsigned int flags = AUTO) throw (bad_loop)
+    : loop_ref (ev_loop_new (flags))
+    {
+      if (!EV_AX)
+        throw bad_loop ();
+    }
+
+    ~dynamic_loop () throw ()
+    {
+      ev_loop_destroy (EV_AX);
+      EV_AX = 0;
+    }
+
+  private:
+
+    dynamic_loop (const dynamic_loop &);
+
+    dynamic_loop & operator= (const dynamic_loop &);
+
+  };
+#endif
+
+  struct default_loop : loop_ref
+  {
+    default_loop (unsigned int flags = AUTO) throw (bad_loop)
+#if EV_MULTIPLICITY
+    : loop_ref (ev_default_loop (flags))
+#endif
+    {
+      if (
+#if EV_MULTIPLICITY
+          !EV_AX
+#else
+          !ev_default_loop (flags)
+#endif
+      )
+        throw bad_loop ();
+    }
+
+  private:
+    default_loop (const default_loop &);
+    default_loop &operator = (const default_loop &);
+  };
+
+  inline loop_ref get_default_loop () throw ()
+  {
+#if EV_MULTIPLICITY
+    return ev_default_loop (0);
+#else
+    return loop_ref ();
+#endif
+  }
+
+#undef EV_AX
+#undef EV_AX_
+
+#undef EV_PX
+#undef EV_PX_
+#if EV_MULTIPLICITY
+#  define EV_PX  loop_ref EV_A
+#  define EV_PX_ loop_ref EV_A_
+#else
+#  define EV_PX
+#  define EV_PX_
+#endif
+
+  template<class ev_watcher, class watcher>
+  struct base : ev_watcher
+  {
+    #if EV_MULTIPLICITY
+      EV_PX;
+
+      // loop set
+      void set (EV_P) throw ()
+      {
+        this->EV_A = EV_A;
+      }
+    #endif
+
+    base (EV_PX) throw ()
+    #if EV_MULTIPLICITY
+      : EV_A (EV_A)
+    #endif
+    {
+      ev_init (this, 0);
+    }
+
+    void set_ (const void *data, void (*cb)(EV_P_ ev_watcher *w, int revents)) throw ()
+    {
+      this->data = (void *)data;
+      ev_set_cb (static_cast<ev_watcher *>(this), cb);
+    }
+
+    // function callback
+    template<void (*function)(watcher &w, int)>
+    void set (void *data = 0) throw ()
+    {
+      set_ (data, function_thunk<function>);
+    }
+
+    template<void (*function)(watcher &w, int)>
+    static void function_thunk (EV_P_ ev_watcher *w, int revents)
+    {
+      function
+        (*static_cast<watcher *>(w), revents);
+    }
+
+    // method callback
+    template<class K, void (K::*method)(watcher &w, int)>
+    void set (K *object) throw ()
+    {
+      set_ (object, method_thunk<K, method>);
+    }
+
+    // default method == operator ()
+    template<class K>
+    void set (K *object) throw ()
+    {
+      set_ (object, method_thunk<K, &K::operator ()>);
+    }
+
+    template<class K, void (K::*method)(watcher &w, int)>
+    static void method_thunk (EV_P_ ev_watcher *w, int revents)
+    {
+      (static_cast<K *>(w->data)->*method)
+        (*static_cast<watcher *>(w), revents);
+    }
+
+    // no-argument callback
+    template<class K, void (K::*method)()>
+    void set (K *object) throw ()
+    {
+      set_ (object, method_noargs_thunk<K, method>);
+    }
+
+    template<class K, void (K::*method)()>
+    static void method_noargs_thunk (EV_P_ ev_watcher *w, int revents)
+    {
+      (static_cast<K *>(w->data)->*method)
+        ();
+    }
+
+    void operator ()(int events = EV_UNDEF)
+    {
+      return
+        ev_cb (static_cast<ev_watcher *>(this))
+          (static_cast<ev_watcher *>(this), events);
+    }
+
+    bool is_active () const throw ()
+    {
+      return ev_is_active (static_cast<const ev_watcher *>(this));
+    }
+
+    bool is_pending () const throw ()
+    {
+      return ev_is_pending (static_cast<const ev_watcher *>(this));
+    }
+
+    void feed_event (int revents) throw ()
+    {
+      ev_feed_event (EV_A_ static_cast<ev_watcher *>(this), revents);
+    }
+  };
+
+  inline tstamp now (EV_P) throw ()
+  {
+    return ev_now (EV_A);
+  }
+
+  inline void delay (tstamp interval) throw ()
+  {
+    ev_sleep (interval);
+  }
+
+  inline int version_major () throw ()
+  {
+    return ev_version_major ();
+  }
+
+  inline int version_minor () throw ()
+  {
+    return ev_version_minor ();
+  }
+
+  inline unsigned int supported_backends () throw ()
+  {
+    return ev_supported_backends ();
+  }
+
+  inline unsigned int recommended_backends () throw ()
+  {
+    return ev_recommended_backends ();
+  }
+
+  inline unsigned int embeddable_backends () throw ()
+  {
+    return ev_embeddable_backends ();
+  }
+
+  inline void set_allocator (void *(*cb)(void *ptr, long size) throw ()) throw ()
+  {
+    ev_set_allocator (cb);
+  }
+
+  inline void set_syserr_cb (void (*cb)(const char *msg) throw ()) throw ()
+  {
+    ev_set_syserr_cb (cb);
+  }
+
+  #if EV_MULTIPLICITY
+    #define EV_CONSTRUCT(cppstem,cstem)	                                                \
+      (EV_PX = get_default_loop ()) throw ()                                            \
+        : base<ev_ ## cstem, cppstem> (EV_A)                                            \
+      {                                                                                 \
+      }
+  #else
+    #define EV_CONSTRUCT(cppstem,cstem)                                                 \
+      () throw ()                                                                       \
+      {                                                                                 \
+      }
+  #endif
+
+  /* using a template here would require quite a bit more lines,
+   * so a macro solution was chosen */
+  #define EV_BEGIN_WATCHER(cppstem,cstem)	                                        \
+                                                                                        \
+  struct cppstem : base<ev_ ## cstem, cppstem>                                          \
+  {                                                                                     \
+    void start () throw ()                                                              \
+    {                                                                                   \
+      ev_ ## cstem ## _start (EV_A_ static_cast<ev_ ## cstem *>(this));                 \
+    }                                                                                   \
+                                                                                        \
+    void stop () throw ()                                                               \
+    {                                                                                   \
+      ev_ ## cstem ## _stop (EV_A_ static_cast<ev_ ## cstem *>(this));                  \
+    }                                                                                   \
+                                                                                        \
+    cppstem EV_CONSTRUCT(cppstem,cstem)                                                 \
+                                                                                        \
+    ~cppstem () throw ()                                                                \
+    {                                                                                   \
+      stop ();                                                                          \
+    }                                                                                   \
+                                                                                        \
+    using base<ev_ ## cstem, cppstem>::set;                                             \
+                                                                                        \
+  private:                                                                              \
+                                                                                        \
+    cppstem (const cppstem &o);                                                         \
+                                                                                        \
+    cppstem &operator =(const cppstem &o);                                              \
+                                                                                        \
+  public:
+
+  #define EV_END_WATCHER(cppstem,cstem)	                                                \
+  };
+
+  EV_BEGIN_WATCHER (io, io)
+    void set (int fd, int events) throw ()
+    {
+      int active = is_active ();
+      if (active) stop ();
+      ev_io_set (static_cast<ev_io *>(this), fd, events);
+      if (active) start ();
+    }
+
+    void set (int events) throw ()
+    {
+      int active = is_active ();
+      if (active) stop ();
+      ev_io_set (static_cast<ev_io *>(this), fd, events);
+      if (active) start ();
+    }
+
+    void start (int fd, int events) throw ()
+    {
+      set (fd, events);
+      start ();
+    }
+  EV_END_WATCHER (io, io)
+
+  EV_BEGIN_WATCHER (timer, timer)
+    void set (ev_tstamp after, ev_tstamp repeat = 0.) throw ()
+    {
+      int active = is_active ();
+      if (active) stop ();
+      ev_timer_set (static_cast<ev_timer *>(this), after, repeat);
+      if (active) start ();
+    }
+
+    void start (ev_tstamp after, ev_tstamp repeat = 0.) throw ()
+    {
+      set (after, repeat);
+      start ();
+    }
+
+    void again () throw ()
+    {
+      ev_timer_again (EV_A_ static_cast<ev_timer *>(this));
+    }
+
+    ev_tstamp remaining ()
+    {
+      return ev_timer_remaining (EV_A_ static_cast<ev_timer *>(this));
+    }
+  EV_END_WATCHER (timer, timer)
+
+  #if EV_PERIODIC_ENABLE
+  EV_BEGIN_WATCHER (periodic, periodic)
+    void set (ev_tstamp at, ev_tstamp interval = 0.) throw ()
+    {
+      int active = is_active ();
+      if (active) stop ();
+      ev_periodic_set (static_cast<ev_periodic *>(this), at, interval, 0);
+      if (active) start ();
+    }
+
+    void start (ev_tstamp at, ev_tstamp interval = 0.) throw ()
+    {
+      set (at, interval);
+      start ();
+    }
+
+    void again () throw ()
+    {
+      ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this));
+    }
+  EV_END_WATCHER (periodic, periodic)
+  #endif
+
+  #if EV_SIGNAL_ENABLE
+  EV_BEGIN_WATCHER (sig, signal)
+    void set (int signum) throw ()
+    {
+      int active = is_active ();
+      if (active) stop ();
+      ev_signal_set (static_cast<ev_signal *>(this), signum);
+      if (active) start ();
+    }
+
+    void start (int signum) throw ()
+    {
+      set (signum);
+      start ();
+    }
+  EV_END_WATCHER (sig, signal)
+  #endif
+
+  #if EV_CHILD_ENABLE
+  EV_BEGIN_WATCHER (child, child)
+    void set (int pid, int trace = 0) throw ()
+    {
+      int active = is_active ();
+      if (active) stop ();
+      ev_child_set (static_cast<ev_child *>(this), pid, trace);
+      if (active) start ();
+    }
+
+    void start (int pid, int trace = 0) throw ()
+    {
+      set (pid, trace);
+      start ();
+    }
+  EV_END_WATCHER (child, child)
+  #endif
+
+  #if EV_STAT_ENABLE
+  EV_BEGIN_WATCHER (stat, stat)
+    void set (const char *path, ev_tstamp interval = 0.) throw ()
+    {
+      int active = is_active ();
+      if (active) stop ();
+      ev_stat_set (static_cast<ev_stat *>(this), path, interval);
+      if (active) start ();
+    }
+
+    void start (const char *path, ev_tstamp interval = 0.) throw ()
+    {
+      stop ();
+      set (path, interval);
+      start ();
+    }
+
+    void update () throw ()
+    {
+      ev_stat_stat (EV_A_ static_cast<ev_stat *>(this));
+    }
+  EV_END_WATCHER (stat, stat)