From 27d57bc40b3b16d81d6d8876ab5ac3c295875046 Mon Sep 17 00:00:00 2001 From: Ruslan Osmanov Date: Wed, 26 Dec 2012 19:46:06 +0000 Subject: [PATCH] Add: ev extension docs git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328897 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/ev/book.xml | 78 +++ reference/ev/configure.xml | 39 ++ reference/ev/constants.xml | 30 + reference/ev/ev.xml | 728 ++++++++++++++++++++++ reference/ev/ev/backend.xml | 70 +++ reference/ev/ev/depth.xml | 68 ++ reference/ev/ev/embeddablebackends.xml | 104 ++++ reference/ev/ev/feedsignal.xml | 77 +++ reference/ev/ev/feedsignalevent.xml | 74 +++ reference/ev/ev/iteration.xml | 65 ++ reference/ev/ev/now.xml | 67 ++ reference/ev/ev/nowupdate.xml | 72 +++ reference/ev/ev/recommendedbackends.xml | 115 ++++ reference/ev/ev/resume.xml | 84 +++ reference/ev/ev/run.xml | 112 ++++ reference/ev/ev/sleep.xml | 64 ++ reference/ev/ev/stop.xml | 72 +++ reference/ev/ev/supportedbackends.xml | 106 ++++ reference/ev/ev/suspend.xml | 79 +++ reference/ev/ev/time.xml | 63 ++ reference/ev/ev/verify.xml | 57 ++ reference/ev/evcheck.xml | 115 ++++ reference/ev/evcheck/construct.xml | 89 +++ reference/ev/evcheck/createstopped.xml | 89 +++ reference/ev/evchild.xml | 134 ++++ reference/ev/evchild/construct.xml | 144 +++++ reference/ev/evchild/createstopped.xml | 109 ++++ reference/ev/evchild/set.xml | 81 +++ reference/ev/evembed.xml | 122 ++++ reference/ev/evembed/construct.xml | 149 +++++ reference/ev/evembed/createstopped.xml | 100 +++ reference/ev/evembed/set.xml | 65 ++ reference/ev/evembed/sweep.xml | 69 ++ reference/ev/evfork.xml | 86 +++ reference/ev/evfork/construct.xml | 91 +++ reference/ev/evfork/createstopped.xml | 90 +++ reference/ev/evidle.xml | 106 ++++ reference/ev/evidle/construct.xml | 89 +++ reference/ev/evidle/createstopped.xml | 90 +++ reference/ev/evio.xml | 139 +++++ reference/ev/evio/construct.xml | 110 ++++ reference/ev/evio/createstopped.xml | 108 ++++ reference/ev/evio/set.xml | 72 +++ reference/ev/evloop.xml | 211 +++++++ reference/ev/evloop/backend.xml | 65 ++ reference/ev/evloop/check.xml | 66 ++ reference/ev/evloop/child.xml | 67 ++ reference/ev/evloop/construct.xml | 102 +++ reference/ev/evloop/defaultloop.xml | 105 ++++ reference/ev/evloop/embed.xml | 70 +++ reference/ev/evloop/fork.xml | 70 +++ reference/ev/evloop/idle.xml | 69 ++ reference/ev/evloop/invokepending.xml | 55 ++ reference/ev/evloop/io.xml | 71 +++ reference/ev/evloop/loopfork.xml | 60 ++ reference/ev/evloop/now.xml | 66 ++ reference/ev/evloop/nowupdate.xml | 67 ++ reference/ev/evloop/periodic.xml | 71 +++ reference/ev/evloop/prepare.xml | 69 ++ reference/ev/evloop/resume.xml | 65 ++ reference/ev/evloop/run.xml | 112 ++++ reference/ev/evloop/signal.xml | 70 +++ reference/ev/evloop/stat.xml | 71 +++ reference/ev/evloop/stop.xml | 73 +++ reference/ev/evloop/suspend.xml | 65 ++ reference/ev/evloop/timer.xml | 72 +++ reference/ev/evloop/verify.xml | 64 ++ reference/ev/evperiodic.xml | 151 +++++ reference/ev/evperiodic/again.xml | 63 ++ reference/ev/evperiodic/at.xml | 61 ++ reference/ev/evperiodic/construct.xml | 143 +++++ reference/ev/evperiodic/createstopped.xml | 132 ++++ reference/ev/evperiodic/set.xml | 105 ++++ reference/ev/evprepare.xml | 76 +++ reference/ev/evprepare/construct.xml | 114 ++++ reference/ev/evprepare/createstopped.xml | 114 ++++ reference/ev/evsignal.xml | 122 ++++ reference/ev/evsignal/construct.xml | 123 ++++ reference/ev/evsignal/createstopped.xml | 123 ++++ reference/ev/evsignal/set.xml | 96 +++ reference/ev/evstat.xml | 132 ++++ reference/ev/evstat/attr.xml | 87 +++ reference/ev/evstat/construct.xml | 132 ++++ reference/ev/evstat/createstopped.xml | 132 ++++ reference/ev/evstat/prev.xml | 87 +++ reference/ev/evstat/set.xml | 105 ++++ reference/ev/evstat/stat.xml | 87 +++ reference/ev/evtimer.xml | 132 ++++ reference/ev/evtimer/again.xml | 87 +++ reference/ev/evtimer/construct.xml | 132 ++++ reference/ev/evtimer/createstopped.xml | 132 ++++ reference/ev/evtimer/set.xml | 105 ++++ reference/ev/evwatcher.xml | 130 ++++ reference/ev/evwatcher/clear.xml | 87 +++ reference/ev/evwatcher/construct.xml | 86 +++ reference/ev/evwatcher/feed.xml | 96 +++ reference/ev/evwatcher/getloop.xml | 87 +++ reference/ev/evwatcher/invoke.xml | 96 +++ reference/ev/evwatcher/keepalive.xml | 96 +++ reference/ev/evwatcher/setcallback.xml | 96 +++ reference/ev/evwatcher/start.xml | 87 +++ reference/ev/evwatcher/stop.xml | 87 +++ reference/ev/examples.xml | 443 +++++++++++++ reference/ev/periodic-modes.xml | 120 ++++ reference/ev/reference.xml | 30 + reference/ev/setup.xml | 57 ++ reference/ev/versions.xml | 203 ++++++ reference/ev/watcher-callbacks.xml | 86 +++ reference/ev/watchers.xml | 68 ++ 109 files changed, 11075 insertions(+) create mode 100644 reference/ev/book.xml create mode 100644 reference/ev/configure.xml create mode 100644 reference/ev/constants.xml create mode 100644 reference/ev/ev.xml create mode 100644 reference/ev/ev/backend.xml create mode 100644 reference/ev/ev/depth.xml create mode 100644 reference/ev/ev/embeddablebackends.xml create mode 100644 reference/ev/ev/feedsignal.xml create mode 100644 reference/ev/ev/feedsignalevent.xml create mode 100644 reference/ev/ev/iteration.xml create mode 100644 reference/ev/ev/now.xml create mode 100644 reference/ev/ev/nowupdate.xml create mode 100644 reference/ev/ev/recommendedbackends.xml create mode 100644 reference/ev/ev/resume.xml create mode 100644 reference/ev/ev/run.xml create mode 100644 reference/ev/ev/sleep.xml create mode 100644 reference/ev/ev/stop.xml create mode 100644 reference/ev/ev/supportedbackends.xml create mode 100644 reference/ev/ev/suspend.xml create mode 100644 reference/ev/ev/time.xml create mode 100644 reference/ev/ev/verify.xml create mode 100644 reference/ev/evcheck.xml create mode 100644 reference/ev/evcheck/construct.xml create mode 100644 reference/ev/evcheck/createstopped.xml create mode 100644 reference/ev/evchild.xml create mode 100644 reference/ev/evchild/construct.xml create mode 100644 reference/ev/evchild/createstopped.xml create mode 100644 reference/ev/evchild/set.xml create mode 100644 reference/ev/evembed.xml create mode 100644 reference/ev/evembed/construct.xml create mode 100644 reference/ev/evembed/createstopped.xml create mode 100644 reference/ev/evembed/set.xml create mode 100644 reference/ev/evembed/sweep.xml create mode 100644 reference/ev/evfork.xml create mode 100644 reference/ev/evfork/construct.xml create mode 100644 reference/ev/evfork/createstopped.xml create mode 100644 reference/ev/evidle.xml create mode 100644 reference/ev/evidle/construct.xml create mode 100644 reference/ev/evidle/createstopped.xml create mode 100644 reference/ev/evio.xml create mode 100644 reference/ev/evio/construct.xml create mode 100644 reference/ev/evio/createstopped.xml create mode 100644 reference/ev/evio/set.xml create mode 100644 reference/ev/evloop.xml create mode 100644 reference/ev/evloop/backend.xml create mode 100644 reference/ev/evloop/check.xml create mode 100644 reference/ev/evloop/child.xml create mode 100644 reference/ev/evloop/construct.xml create mode 100644 reference/ev/evloop/defaultloop.xml create mode 100644 reference/ev/evloop/embed.xml create mode 100644 reference/ev/evloop/fork.xml create mode 100644 reference/ev/evloop/idle.xml create mode 100644 reference/ev/evloop/invokepending.xml create mode 100644 reference/ev/evloop/io.xml create mode 100644 reference/ev/evloop/loopfork.xml create mode 100644 reference/ev/evloop/now.xml create mode 100644 reference/ev/evloop/nowupdate.xml create mode 100644 reference/ev/evloop/periodic.xml create mode 100644 reference/ev/evloop/prepare.xml create mode 100644 reference/ev/evloop/resume.xml create mode 100644 reference/ev/evloop/run.xml create mode 100644 reference/ev/evloop/signal.xml create mode 100644 reference/ev/evloop/stat.xml create mode 100644 reference/ev/evloop/stop.xml create mode 100644 reference/ev/evloop/suspend.xml create mode 100644 reference/ev/evloop/timer.xml create mode 100644 reference/ev/evloop/verify.xml create mode 100644 reference/ev/evperiodic.xml create mode 100644 reference/ev/evperiodic/again.xml create mode 100644 reference/ev/evperiodic/at.xml create mode 100644 reference/ev/evperiodic/construct.xml create mode 100644 reference/ev/evperiodic/createstopped.xml create mode 100644 reference/ev/evperiodic/set.xml create mode 100644 reference/ev/evprepare.xml create mode 100644 reference/ev/evprepare/construct.xml create mode 100644 reference/ev/evprepare/createstopped.xml create mode 100644 reference/ev/evsignal.xml create mode 100644 reference/ev/evsignal/construct.xml create mode 100644 reference/ev/evsignal/createstopped.xml create mode 100644 reference/ev/evsignal/set.xml create mode 100644 reference/ev/evstat.xml create mode 100644 reference/ev/evstat/attr.xml create mode 100644 reference/ev/evstat/construct.xml create mode 100644 reference/ev/evstat/createstopped.xml create mode 100644 reference/ev/evstat/prev.xml create mode 100644 reference/ev/evstat/set.xml create mode 100644 reference/ev/evstat/stat.xml create mode 100644 reference/ev/evtimer.xml create mode 100644 reference/ev/evtimer/again.xml create mode 100644 reference/ev/evtimer/construct.xml create mode 100644 reference/ev/evtimer/createstopped.xml create mode 100644 reference/ev/evtimer/set.xml create mode 100644 reference/ev/evwatcher.xml create mode 100644 reference/ev/evwatcher/clear.xml create mode 100644 reference/ev/evwatcher/construct.xml create mode 100644 reference/ev/evwatcher/feed.xml create mode 100644 reference/ev/evwatcher/getloop.xml create mode 100644 reference/ev/evwatcher/invoke.xml create mode 100644 reference/ev/evwatcher/keepalive.xml create mode 100644 reference/ev/evwatcher/setcallback.xml create mode 100644 reference/ev/evwatcher/start.xml create mode 100644 reference/ev/evwatcher/stop.xml create mode 100644 reference/ev/examples.xml create mode 100644 reference/ev/periodic-modes.xml create mode 100644 reference/ev/reference.xml create mode 100644 reference/ev/setup.xml create mode 100644 reference/ev/versions.xml create mode 100644 reference/ev/watcher-callbacks.xml create mode 100644 reference/ev/watchers.xml diff --git a/reference/ev/book.xml b/reference/ev/book.xml new file mode 100644 index 0000000000..96c7219b3f --- /dev/null +++ b/reference/ev/book.xml @@ -0,0 +1,78 @@ + + + + + Ev + Ev + + + &reftitle.intro; + + This extension provides inteface to libev library - a high performance + full-featured event loop written in C. + + + ¬e.no-windows.extension; + + + 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 documentation + of libev + + + + &reference.ev.setup; + &reference.ev.constants; + &reference.ev.examples; + &reference.ev.watchers; + &reference.ev.watcher-callbacks; + &reference.ev.periodic-modes; + &reference.ev.ev; + &reference.ev.evcheck; + &reference.ev.evchild; + &reference.ev.evembed; + &reference.ev.evfork; + &reference.ev.evidle; + &reference.ev.evio; + &reference.ev.evloop; + &reference.ev.evperiodic; + &reference.ev.evprepare; + &reference.ev.evsignal; + &reference.ev.evstat; + &reference.ev.evtimer; + &reference.ev.evwatcher; + + + + diff --git a/reference/ev/configure.xml b/reference/ev/configure.xml new file mode 100644 index 0000000000..1e32f499b6 --- /dev/null +++ b/reference/ev/configure.xml @@ -0,0 +1,39 @@ + + + +
+ &reftitle.install; + + + &pecl.info; + &url.pecl.package;ev + + + For information about manual installation, please + read the file INSTALL.md included in the package source. + + + +
+ + + diff --git a/reference/ev/constants.xml b/reference/ev/constants.xml new file mode 100644 index 0000000000..a9631e388f --- /dev/null +++ b/reference/ev/constants.xml @@ -0,0 +1,30 @@ + + + + + &reftitle.constants; + &no.constants; + Most constants are moved to Ev + singleton class. + + + diff --git a/reference/ev/ev.xml b/reference/ev/ev.xml new file mode 100644 index 0000000000..00d867830d --- /dev/null +++ b/reference/ev/ev.xml @@ -0,0 +1,728 @@ + + + + + + The Ev class + Ev + + + + +
+ &reftitle.intro; + + Ev is a singleton providing access to the default loop and to some common + operations. + +
+ + +
+ &reftitle.classsynopsis; + + + + Ev + + + + + Ev + + + + + Constants + + const + integer + Ev::FLAG_AUTO + 0 + + + const + integer + Ev::FLAG_NOENV + 16777216 + + + const + integer + Ev::FLAG_FORKCHECK + 33554432 + + + const + integer + Ev::FLAG_NOINOTIFY + 1048576 + + + const + integer + Ev::FLAG_SIGNALFD + 2097152 + + + const + integer + Ev::FLAG_NOSIGMASK + 4194304 + + + const + integer + Ev::RUN_NOWAIT + 1 + + + const + integer + Ev::RUN_ONCE + 2 + + + const + integer + Ev::BREAK_CANCEL + 0 + + + const + integer + Ev::BREAK_ONE + 1 + + + const + integer + Ev::BREAK_ALL + 2 + + + const + integer + Ev::MINPRI + -2 + + + const + integer + Ev::MAXPRI + 2 + + + const + integer + Ev::READ + 1 + + + const + integer + Ev::WRITE + 2 + + + const + integer + Ev::TIMER + 256 + + + const + integer + Ev::PERIODIC + 512 + + + const + integer + Ev::SIGNAL + 1024 + + + const + integer + Ev::CHILD + 2048 + + + const + integer + Ev::STAT + 4096 + + + const + integer + Ev::IDLE + 8192 + + + const + integer + Ev::PREPARE + 16384 + + + const + integer + Ev::CHECK + 32768 + + + const + integer + Ev::EMBED + 65536 + + + const + integer + Ev::CUSTOM + 16777216 + + + const + integer + Ev::ERROR + 2147483648 + + + const + integer + Ev::BACKEND_SELECT + 1 + + + const + integer + Ev::BACKEND_POLL + 2 + + + const + integer + Ev::BACKEND_EPOLL + 4 + + + const + integer + Ev::BACKEND_KQUEUE + 8 + + + const + integer + Ev::BACKEND_DEVPOLL + 16 + + + const + integer + Ev::BACKEND_PORT + 32 + + + const + integer + Ev::BACKEND_ALL + 63 + + + const + integer + Ev::BACKEND_MASK + 65535 + + + + &Methods; + + + + +
+ + +
+ &reftitle.constants; + + Flags passed to create a loop: + + + + Ev::FLAG_AUTO + + The default flags value + + + + Ev::FLAG_NOENV + + + If this flag used(or the program runs setuid or setgid), + libev won't look at the environment variable + LIBEV_FLAGS. Otherwise(by default), + LIBEV_FLAGS will override the flags completely if it + is found. Useful for performance tests and searching for bugs. + + + + + + Ev::FLAG_FORKCHECK + + + Makes libev check for a fork in each iteration, instead of calling + EvLoop::fork manually. + + This works by calling getpid() on every iteration of + the loop, and thus this might slow down your event loop if you do a lot of + loop iterations, but usually is not noticeable. + + This flag setting cannot be overridden or specified in the + LIBEV_FLAGS environment variable. + + + + + + Ev::FLAG_NOINOTIFY + + + When this flag is specified, libev won't attempt to + use the inotify API for its ev_stat + watchers. The flag can be useful to conserve inotify file descriptors, as + otherwise each loop using ev_stat watchers consumes + one inotify handle. + + + + + + Ev::FLAG_SIGNALFD + + + When this flag is specified, libev will attempt to + use the signalfd API for its + ev_signal + (and ev_child) + watchers. This API delivers signals synchronously, which makes it both + faster and might make it possible to get the queued signal data. It can + also simplify signal handling with threads, as long as you properly block + signals in your threads that are not interested in handling them. + + Signalfd will not be used by default. + + + + + + Ev::FLAG_NOSIGMASK + + + When this flag is specified, libev will avoid to + modify the signal mask. Specifically, this means you have to make sure + signals are unblocked when you want to receive them. + + This behaviour is useful when you want to do your own signal handling, or + want to handle signals only in specific threads and want to avoid + libev unblocking the signals. + + + + + + + + Flags passed to Ev::run, or EvLoop::run + + + + Ev::RUN_NOWAIT + + + Means that event loop will look for new events, will handle those events + and any already outstanding ones, but will not wait and block your + process in case there are no events and will return after one iteration + of the loop. This is sometimes useful to poll and handle new events + while doing lengthy calculations, to keep the program responsive. + + + + + + Ev::RUN_ONCE + + + Means that even loop will look for new events(waiting if + necessary) and will handle those and any already outstanding ones. It + will block your process until at least one new event arrives (which could + be an event internal to libev itself, so there is no guarantee that a + user-registered callback will be called), and will return after one + iteration of the loop. + + + + + + + Flags passed to Ev::stop, or + EvLoop::stop + + + + Ev::BREAK_CANCEL + + + Cancel the break operation. + + + + + + Ev::BREAK_ONE + + + Makes the innermost Ev::run(or + EvLoop::run) call return. + + + + + + Ev::BREAK_ALL + + + Makes all nested Ev::run(or + EvLoop::run) calls return. + + + + + + + + Watcher priorities: + + + + Ev::MINPRI + + + Minimum allowed watcher priority. + + + + + + Ev::MAXPRI + + + Maximum allowed watcher priority. + + + + + + + + Bit masks of (received) events: + + + + Ev::READ + + + The file descriptor in the EvIo watcher has become + readable. + + + + + + Ev::WRITE + + + The file descriptor in the EvIo watcher has become + writable. + + + + + + Ev::TIMER + + + EvTimer watcher has been timed out. + + + + + + Ev::PERIODIC + + + EvPeriodic watcher has been timed out. + + + + + + Ev::SIGNAL + + + A signal specified in EvSignal::__construct has + been received. + + + + + + Ev::CHILD + + + The pid specified in + EvChild::__construct has received a status + change. + + + + + + Ev::STAT + + + The path specified in EvStat watcher changed its + attributes. + + + + + + Ev::IDLE + + + EvIdle watcher works when there is nothing to do + with other watchers. + + + + + + Ev::PREPARE + + + All EvPrepare watchers are invoked just before + Ev::run starts. Thus, + EvPrepare watchers are the last watchers invoked + before the event loop sleeps or polls for new events. + + + + + + Ev::CHECK + + + All EvCheck watchers are queued just after + Ev::run has gathered the new events, but before it + queues any callbacks for any received events. Thus, + EvCheck watchers will be invoked before any other + watchers of the same or lower priority within an event loop iteration. + + + + + + Ev::EMBED + + + The embedded event loop specified in the EvEmbed watcher needs attention. + + + + + + Ev::CUSTOM + + + Not ever sent(or otherwise used) by libev itself, + but can be freely used by libev users to signal + watchers (e.g. via EvWatcher::feed). + + + + + + Ev::ERROR + + + An unspecified error has occurred, the watcher has been stopped. This + might happen because the watcher could not be properly started because + libev ran out of memory, a file descriptor was found + to be closed or any other problem. Libev considers + these application bugs. + + See also ANATOMY + OF A WATCHER + + + + + + + + Backend flags: + + + + Ev::BACKEND_SELECT + + + select(2) backend + + + + + + Ev::BACKEND_POLL + + + poll(2) backend + + + + + + Ev::BACKEND_EPOLL + + + Linux-specific epoll(7) backendf or both pre- and post-2.6.9 kernels + + + + + + Ev::BACKEND_KQUEUE + + + kqueue backend used on most BSD systems. + EvEmbed watcher could be used to embed one + loop(with kqueue backend) into another. For instance, you can try to + create an event loop with kqueue backend and use it + for sockets only. + + + + + + Ev::BACKEND_DEVPOLL + + + Solaris 8 backend. This is not implemented yet. + + + + + + Ev::BACKEND_PORT + + + Solaris 10 event port mechanism with a good scaling. + + + + + + Ev::BACKEND_ALL + + + Try all backends(even currupted ones). It's not recommended to use it + explicitly. You should apply bitwise operators(e.g. + Ev::BACKEND_ALL & + ~Ev::BACKEND_KQUEUE) + Use Ev::recommendedBackends, or don't specify any + backends at all. + + + + + + Ev::BACKEND_MASK + + + Not a backend, but a mask to select all backend bits from a + flags value, in case you want to mask out any + backends from a flags value (e.g. when modifying the + LIBEV_FLAGS environment variable). + + + + + + + + + + For the default loop during module initialization phase Ev registers + ev_loop_fork + call by means of pthread_atfork(if available). + + + + + + There are methods providing access to the default event + loop in Ev class(e.g. + Ev::iteration, Ev::depth + etc.) For custom loops(created with + EvLoop::__construct) you can access these values + via corresponding properties and methods of EvLoop + class. + + + + The instance of the default event loop itself can be fetched by means of + Ev::defaultLoop method. + + + +
+ + +
+ + &reference.ev.entities.ev; + +
+ + diff --git a/reference/ev/ev/backend.xml b/reference/ev/ev/backend.xml new file mode 100644 index 0000000000..23e411a2fd --- /dev/null +++ b/reference/ev/ev/backend.xml @@ -0,0 +1,70 @@ + + + + + + Ev::backend + Returns an integer describing the backend used by libev. + + + + &reftitle.description; + + final public + static intEv::backend + + + + Returns an integer describing the backend used by + libev. + See Backend flags + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns an integer(bit mask) describing the backend used by + libev. + + + + + &reftitle.seealso; + + EvEmbed + Ev::embeddableBackends + Ev::recommendedBackends + Ev::supportedBackends + Backend flags + + + + + + diff --git a/reference/ev/ev/depth.xml b/reference/ev/ev/depth.xml new file mode 100644 index 0000000000..d25ef8f360 --- /dev/null +++ b/reference/ev/ev/depth.xml @@ -0,0 +1,68 @@ + + + + + + Ev::depth + Returns recursion depth + + + + &reftitle.description; + + final public + static intEv::depth + + + + The number of times Ev::run was entered minus the number + of times Ev::run was exited normally, in other words, the + recursion depth. Outside Ev::run, this number is + 0. In a callback, this number is 1, + unless Ev::run was invoked recursively (or from another + thread), in which case it is higher. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + ev_depth returns recursion depth of the default loop. + + + + + &reftitle.seealso; + + Ev::iteration + + + + + + diff --git a/reference/ev/ev/embeddablebackends.xml b/reference/ev/ev/embeddablebackends.xml new file mode 100644 index 0000000000..86fcdf1817 --- /dev/null +++ b/reference/ev/ev/embeddablebackends.xml @@ -0,0 +1,104 @@ + + + + + + Ev::embeddableBackends + Returns the set of backends that are embeddable in other event loops. + + + + &reftitle.description; + + final public static voidEv::embeddableBackends + + + + Returns the set of backends that are embeddable in other event loops. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns a bit mask which can containing backend flags combined using + bitwise OR operator. + + + + + &reftitle.examples; + + Embedding loop created with kqueue backend into the default loop + + +]]> + + + + + + &reftitle.seealso; + + EvEmbed + Ev::recommendedBackends + Ev::supportedBackends + Backend flags + Examples + + + + + + diff --git a/reference/ev/ev/feedsignal.xml b/reference/ev/ev/feedsignal.xml new file mode 100644 index 0000000000..228d01ba52 --- /dev/null +++ b/reference/ev/ev/feedsignal.xml @@ -0,0 +1,77 @@ + + + + + + Ev::feedSignal + Feed a signal event info Ev + + + + &reftitle.description; + + final public static voidEv::feedSignal + intsignum + + + Simulates a signal receive. It is safe to call this function at + any time, from any context, including signal handlers or random threads. + Its main use is to customise signal handling in your process. + + + Unlike Ev::feedSignalEvent, this works regardless + of which loop has registered the signal. + + + + + &reftitle.parameters; + + + signum + + + Signal number. See signal(7) man page for detals. + You can use constants exported by pcntl extension. + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + Ev::feedSignalEvent + + + + + + diff --git a/reference/ev/ev/feedsignalevent.xml b/reference/ev/ev/feedsignalevent.xml new file mode 100644 index 0000000000..126d9e2a42 --- /dev/null +++ b/reference/ev/ev/feedsignalevent.xml @@ -0,0 +1,74 @@ + + + + + + Ev::feedSignalEvent + Feed signal event into the default loop + + + + &reftitle.description; + + final public static + voidEv::feedSignalEvent + intsignum + + + Feed signal event into the default loop. Ev will react to this call as if + the signal specified by signal had occured. + + + + + + &reftitle.parameters; + + + signum + + + Signal number. See signal(7) man page for detals. + You can use constants exported by pcntl extension. + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + Ev::feedSignal + + + + + + diff --git a/reference/ev/ev/iteration.xml b/reference/ev/ev/iteration.xml new file mode 100644 index 0000000000..bc9ed86d95 --- /dev/null +++ b/reference/ev/ev/iteration.xml @@ -0,0 +1,65 @@ + + + + + + Ev::iteration + Return the number of times the default event loop has polled for new + events. + + + + &reftitle.description; + + final public + static intEv::iteration + + + + Return the number of times the event loop has polled for new events. + Sometimes useful as a generation counter. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns number of polls of the default event loop. + + + + + &reftitle.seealso; + + Ev::depth + + + + + + diff --git a/reference/ev/ev/now.xml b/reference/ev/ev/now.xml new file mode 100644 index 0000000000..cacee1089b --- /dev/null +++ b/reference/ev/ev/now.xml @@ -0,0 +1,67 @@ + + + + + + Ev::now + Returns the time when the last iteration of the default event + loop has started. + + + + &reftitle.description; + + final public + static doubleEv::now + + + + Returns the time when the last iteration of the default event loop has + started. This is the time that timers(EvTimer and + EvPeriodic) are based on, and referring to it is + usually faster then calling Ev::time. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns number of seconds(fractional) representing the time when the last + iteration of the default event loop has started. + + + + + &reftitle.seealso; + + Ev::nowUpdate + + + + + + diff --git a/reference/ev/ev/nowupdate.xml b/reference/ev/ev/nowupdate.xml new file mode 100644 index 0000000000..d6e952c56d --- /dev/null +++ b/reference/ev/ev/nowupdate.xml @@ -0,0 +1,72 @@ + + + + + + Ev::nowUpdate + Establishes the current time by querying the kernel, updating the time + returned by Ev::now in the progress. + + + + &reftitle.description; + + final public static voidEv::nowUpdate + + + + Establishes the current time by querying the kernel, updating the time + returned by Ev::now in the progress. This is a + costly operation and is usually done automatically within + Ev::run. + + + + This method is rarely useful, but when some event callback runs for a very + long time without entering the event loop, updating + libev's consideration of the current time is a good + idea. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + Ev::now + + + + + + diff --git a/reference/ev/ev/recommendedbackends.xml b/reference/ev/ev/recommendedbackends.xml new file mode 100644 index 0000000000..a2e4a12cfb --- /dev/null +++ b/reference/ev/ev/recommendedbackends.xml @@ -0,0 +1,115 @@ + + + + + + Ev::recommendedBackends + Returns a bit mask of recommended backends for current + platform. + + + + &reftitle.description; + + final public static voidEv::recommendedBackends + + + + Returns the set of all backends compiled into this binary of + libev and also recommended for this platform, meaning it + will work for most file descriptor types. This set is often smaller than the + one returned by ev_supported_backends, as for example + kqueue is broken on most BSD systems + and will not be auto-detected unless you explicitly request it. This is the + set of backends that libev will probe for you if you + specify no backends explicitly. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns a bit mask which can containing backend flags combined using + bitwise OR operator. + + + + + &reftitle.examples; + + Embedding one loop into another + + +]]> + + + + + + &reftitle.seealso; + + EvEmbed + Ev::embeddableBackends + Ev::supportedBackends + Backend flags + Examples + + + + + + diff --git a/reference/ev/ev/resume.xml b/reference/ev/ev/resume.xml new file mode 100644 index 0000000000..00d2ecaf4f --- /dev/null +++ b/reference/ev/ev/resume.xml @@ -0,0 +1,84 @@ + + + + + + Ev::resume + Resume previously suspended default event loop + + + + &reftitle.description; + + final public static voidEv::resume + + + + Ev::suspend and + Ev::resume methods suspend and resume a loop + correspondingly. + + + + All timer watchers will be delayed by the time spend between + suspend and resume, and all + periodic watchers will be rescheduled(that is, they + will lose any events that would have occured while suspended). + + + + After calling Ev::suspend you must not call any + function on the given loop other than Ev::resume, + and you must not call Ev::resume + without a previous call to Ev::suspend. + + + + Calling suspend/resume has the + side effect of updating the event loop time(see + Ev::nowUpdate). + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + Ev::suspend + + + + + + diff --git a/reference/ev/ev/run.xml b/reference/ev/ev/run.xml new file mode 100644 index 0000000000..1286221210 --- /dev/null +++ b/reference/ev/ev/run.xml @@ -0,0 +1,112 @@ + + + + + + Ev::run + Begin checking for events and calling callbacks for the default + loop + + + + &reftitle.description; + + final public static + voidEv::run + intflags + + + Begin checking for events and calling callbacks for the default + loop. Returns when a callback calls + Ev::stop method, or the flags are nonzero(in which + case the return value is true) or when there are no active watchers which + reference the loop(EvWatcher::keepalive is &true;), + in which case the return value will be &false;. The return value can + generally be interpreted as if &true;, there is more work left to + do. + + + + + + &reftitle.parameters; + + + flags + + + Optional parameter flags can be one of the following: + + + List for possible values of <parameter>flags</parameter> + + + + + flags + Description + + + + + 0 + The default behavior described above + + + Ev::RUN_ONCE + Block at most one(wait, but don't loop) + + + Ev::RUN_NOWAIT + Don't block at all(fetch/handle events, but don't wait) + + + +
+
+ + See the run flag + constants. + +
+
+
+
+ + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + Ev::stop + EvLoop::run + + + +
+ + diff --git a/reference/ev/ev/sleep.xml b/reference/ev/ev/sleep.xml new file mode 100644 index 0000000000..995c2145f7 --- /dev/null +++ b/reference/ev/ev/sleep.xml @@ -0,0 +1,64 @@ + + + + + + Ev::sleep + Block the process for the given number of seconds. + + + + &reftitle.description; + + final public static voidEv::sleep + doubleseconds + + + Block the process for the given number of seconds. + + + + + + &reftitle.parameters; + + + seconds + + + Fractional number of seconds + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/ev/ev/stop.xml b/reference/ev/ev/stop.xml new file mode 100644 index 0000000000..668ff823a8 --- /dev/null +++ b/reference/ev/ev/stop.xml @@ -0,0 +1,72 @@ + + + + + + Ev::stop + Stops the default event loop + + + + &reftitle.description; + + final public static voidEv::stop + inthow + + + Stops the default event loop + + + + + + &reftitle.parameters; + + + how + + + One of Ev::BREAK_* constants. + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + Ev::run + + + + + + diff --git a/reference/ev/ev/supportedbackends.xml b/reference/ev/ev/supportedbackends.xml new file mode 100644 index 0000000000..770411adf7 --- /dev/null +++ b/reference/ev/ev/supportedbackends.xml @@ -0,0 +1,106 @@ + + + + + + Ev::supportedBackends + Returns the set of backends supported by current libev + configuration. + + + + &reftitle.description; + + final public static voidEv::supportedBackends + + + + Returns the set of backends supported by current libev + configuration. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns a bit mask which can containing backend flags combined using + bitwise OR operator. + + + + + &reftitle.examples; + + Embedding loop created with kqueue backend into the default loop + + +]]> + + + + + + &reftitle.seealso; + + EvEmbed + Ev::recommendedBackends + Ev::embeddableBackends + Backend flags + Examples + + + + + + diff --git a/reference/ev/ev/suspend.xml b/reference/ev/ev/suspend.xml new file mode 100644 index 0000000000..e85f92eb78 --- /dev/null +++ b/reference/ev/ev/suspend.xml @@ -0,0 +1,79 @@ + + + + + + Ev::suspend + Suspend the default event loop + + + + &reftitle.description; + + final public static voidEv::suspend + + + + + Ev::suspend and + Ev::resume methods suspend and resume the default + loop correspondingly. + + + + All timer watchers will be delayed by the time spend between + suspend and resume, and all + periodic watchers will be rescheduled(that is, they + will lose any events that would have occured while suspended). + + + + After calling Ev::suspend you must not call any + function on the given loop other than Ev::resume, + and you must not call Ev::resume + without a previous call to Ev::suspend. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + Ev::resume + + + + + + diff --git a/reference/ev/ev/time.xml b/reference/ev/ev/time.xml new file mode 100644 index 0000000000..89a9a3e878 --- /dev/null +++ b/reference/ev/ev/time.xml @@ -0,0 +1,63 @@ + + + + + + Ev::time + Returns the current time in fractional seconds since the epoch. + + + + &reftitle.description; + + final public + static doubleEv::time + + + + Returns the current time in fractional seconds since the epoch. Consider + using Ev::now + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the current time in fractional seconds since the epoch. + + + + + &reftitle.seealso; + + Ev::now + + + + + + diff --git a/reference/ev/ev/verify.xml b/reference/ev/ev/verify.xml new file mode 100644 index 0000000000..bf53b7f049 --- /dev/null +++ b/reference/ev/ev/verify.xml @@ -0,0 +1,57 @@ + + + + + + Ev::verify + Performs internal consistency checks(for debugging) + + + + &reftitle.description; + + final public static voidEv::verify + + + + Performs internal consistency checks(for debugging + libev) and abort the program if any data structures + were found to be corrupted. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/ev/evcheck.xml b/reference/ev/evcheck.xml new file mode 100644 index 0000000000..5881eaf1e1 --- /dev/null +++ b/reference/ev/evcheck.xml @@ -0,0 +1,115 @@ + + + + + + The EvCheck class + EvCheck + + + + +
+ &reftitle.intro; + + EvPrepare and EvCheck + watchers are usually used in pairs. EvPrepare + watchers get invoked before the process blocks, + EvCheck afterwards. + + + You must not call EvLoop::run or similar methods + or functions that enter the current event loop from either + EvPrepare or + EvCheck watchers. Other loops than the current one are fine, however. The + rationale behind this is that you do not need to check for recursion in + those watchers, i.e. the sequence will always be: + EvPrepare -> blocking -> + EvCheck, so if you have one watcher of each kind they will always be called + in pairs bracketing the blocking + call. + + + The main purpose is to integrate other event mechanisms into + libev and their use is somewhat advanced. They could + be used, for example, to track variable changes, implement your own + watchers, integrate net-snmp or a coroutine library and lots more. They are + also occasionally useful if you cache some data and want to flush it before + blocking. + + + It is recommended to give EvCheck watchers + highest(Ev::MAXPRI) priority, to ensure that they are + being run before any other watchers after the poll (this doesn’t matter for + EvPrepare watchers). + + + Also, EvCheck watchers should not activate/feed + events. While libev fully supports this, they might + get executed before other EvCheck watchers did their job. + + +
+ + + +
+ &reftitle.classsynopsis; + + + + EvCheck + + + + + EvCheck + + + + extends + EvWatcher + + + + + &InheritedProperties; + + + &Methods; + + + &InheritedMethods; + + + + + +
+ +
+ + &reference.ev.entities.evcheck; + +
+ + diff --git a/reference/ev/evcheck/construct.xml b/reference/ev/evcheck/construct.xml new file mode 100644 index 0000000000..2141522626 --- /dev/null +++ b/reference/ev/evcheck/construct.xml @@ -0,0 +1,89 @@ + + + + + + EvCheck::__construct + Constructs the EvCheck watcher object + + + + &reftitle.description; + + public EvCheck::__construct + callablecallback + mixeddata + intpriority + + + Constructs the EvCheck watcher object. + + + + + &reftitle.parameters; + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvCheck object on success. + + + + + &reftitle.seealso; + + EvPrepare + EvLoop::check + + + + + + diff --git a/reference/ev/evcheck/createstopped.xml b/reference/ev/evcheck/createstopped.xml new file mode 100644 index 0000000000..93c57d645e --- /dev/null +++ b/reference/ev/evcheck/createstopped.xml @@ -0,0 +1,89 @@ + + + + + + EvCheck::createStopped + Create instance of a stopped EvCheck watcher + + + + &reftitle.description; + + public static objectEvCheck::createStopped + stringcallback + stringdata + stringpriority + + + Create instance of a stopped EvCheck watcher + + + + + + &reftitle.parameters; + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvCheck object on success. + + + + + &reftitle.seealso; + + EvPrepare + + + + + + diff --git a/reference/ev/evchild.xml b/reference/ev/evchild.xml new file mode 100644 index 0000000000..f8fec645a3 --- /dev/null +++ b/reference/ev/evchild.xml @@ -0,0 +1,134 @@ + + + + + + The EvChild class + EvChild + + + + +
+ &reftitle.intro; + + EvChild watchers trigger when your process receives + a SIGCHLD in response to some child status changes + (most typically when a child of yours dies or exits). It is permissible to + install an EvChild watcher after the child has been + forked(which implies it might have already exited), as long as the event + loop isn't entered(or is continued from a watcher), i.e. forking and then + immediately registering a watcher for the child is fine, but forking and + registering a watcher a few event loop iterations later or in the next + callback invocation is not. + + + It is allowed to register EvChild watchers in the + default loop only. + +
+ + +
+ &reftitle.classsynopsis; + + + + EvChild + + + + + EvChild + + + + extends + EvWatcher + + + + &Properties; + + public + pid + + + public + rpid + + + public + rstatus + + + &InheritedProperties; + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + + +
+ &reftitle.properties; + + + pid + + Readonly. The process ID this watcher watches + out for, or 0, meaning any process ID. + + + + rpid + + Readonly.The process ID that detected a status change. + + + + rstatus + + Readonly. The process exit status caused by + rpid. + + + +
+ + + +
+ + &reference.ev.entities.evchild; + +
+ + diff --git a/reference/ev/evchild/construct.xml b/reference/ev/evchild/construct.xml new file mode 100644 index 0000000000..4a028d6985 --- /dev/null +++ b/reference/ev/evchild/construct.xml @@ -0,0 +1,144 @@ + + + + + + EvChild::__construct + Constructs the EvChild watcher object + + + + &reftitle.description; + + public EvChild::__construct + intpid + booltrace + callablecallback + mixeddata&null; + intpriority0 + + + Constructs the EvChild watcher object. + + + Call the callback when a status change for process ID + pid(or any PID if + pid is 0) has been received(a + status change happens when the process terminates or is killed, or, when + trace is &true;, additionally when it is stopped or + continued). In other words, when the process receives a + SIGCHLD, Ev will fetch the + outstanding exit/wait status for all changed/zombie children and call the + callback. + + + It is valid to install a child watcher after an + EvChild has exited but before the event loop has + started its next iteration(for example, first you fork, then the new child + process might exit, and only then do you install an + EvChild watcher in the parent for the new + PID). + + + You can access both exit/tracing status and pid by + using the rstatus and rpid + properties of the watcher object. + + + You can have as many PID watchers per + PID as you want, they will all be called. + + + The EvChild::createStopped method doesn't + start(activate) the newly created watcher. + + + + + + &reftitle.parameters; + + + pid + + + Wait for status changes of process PID(or any process if PID is specified + as 0). + + + + + trace + + + If &false;, only activate the watcher when the process terminates. + Otherwise(&true;) additionally activate the watcher when the process is + stopped or continued. + + + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvChild object on success. + + + + + &reftitle.seealso; + + EvLoop::child + + + + + + diff --git a/reference/ev/evchild/createstopped.xml b/reference/ev/evchild/createstopped.xml new file mode 100644 index 0000000000..992d42e441 --- /dev/null +++ b/reference/ev/evchild/createstopped.xml @@ -0,0 +1,109 @@ + + + + + + EvChild::createStopped + Create instance of a stopped EvCheck watcher + + + + &reftitle.description; + + public static objectEvChild::createStopped + intpid + booltrace + callablecallback + mixeddata + intpriority + + + The same as EvChild::__construct, but doesn't start + the watcher automatically. + + + + + + &reftitle.parameters; + + + pid + + + The same as for EvChild::__construct + + + + + trace + + + The same as for EvChild::__construct + + + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.seealso; + + EvChild::__construct + EvLoop::child + + + + + + diff --git a/reference/ev/evchild/set.xml b/reference/ev/evchild/set.xml new file mode 100644 index 0000000000..48bbb4acc7 --- /dev/null +++ b/reference/ev/evchild/set.xml @@ -0,0 +1,81 @@ + + + + + + EvChild::set + Configures the watcher + + + + &reftitle.description; + + public voidEvChild::set + intpid + booltrace + + + + + + + + + &reftitle.parameters; + + + pid + + + The same as for EvChild::__construct + + + + + trace + + + The same as for EvChild::__construct + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + + &reftitle.seealso; + + EvChild::__construct + + + + + + diff --git a/reference/ev/evembed.xml b/reference/ev/evembed.xml new file mode 100644 index 0000000000..cecc8cadaf --- /dev/null +++ b/reference/ev/evembed.xml @@ -0,0 +1,122 @@ + + + + + + The EvEmbed class + EvEmbed + + + + +
+ &reftitle.intro; + + Used to embed one event loop into another. + +
+ + +
+ &reftitle.classsynopsis; + + + + EvEmbed + + + + + EvEmbed + + + + extends + EvWatcher + + + + &Properties; + + public + embed + + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + + +
+ &reftitle.properties; + + + is_active + + + + + + data + + + + + + is_pending + + + + + + priority + + + + + + embed + + + + + +
+ + + +
+ + &reference.ev.entities.evembed; + +
+ + diff --git a/reference/ev/evembed/construct.xml b/reference/ev/evembed/construct.xml new file mode 100644 index 0000000000..e944ae8eb8 --- /dev/null +++ b/reference/ev/evembed/construct.xml @@ -0,0 +1,149 @@ + + + + + + EvEmbed::__construct + Constructs the EvEmbed object + + + + &reftitle.description; + + public EvEmbed::__construct + objectother + callablecallback + mixeddata + intpriority + + + This is a rather advanced watcher type that lets you embed one event loop + into another(currently only IO events are supported in the embedded loop, + other types of watchers might be handled in a delayed or incorrect fashion + and must not be used). + + + See the + libev documentation for details. + + + This watcher is most useful on BSD systems without + working kqueue to still be able to handle a large number + of sockets. See example below. + + + + + &reftitle.parameters; + + + other + + + Instance of EvLoop. The loop to embed, this loop + must be embeddable(see Ev::embeddableBackends). + + + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvEmbed object on success. + + + + + &reftitle.examples; + + Embedding loop created with kqueue backend into the default loop + + +]]> + + + + + + + &reftitle.seealso; + + Ev::embeddableBackends + + + + + + diff --git a/reference/ev/evembed/createstopped.xml b/reference/ev/evembed/createstopped.xml new file mode 100644 index 0000000000..3754de8c48 --- /dev/null +++ b/reference/ev/evembed/createstopped.xml @@ -0,0 +1,100 @@ + + + + + + EvEmbed::createStopped + Create stopped EvEmbed watcher object + + + + &reftitle.description; + + public static voidEvEmbed::createStopped + objectother + callablecallback + mixeddata + intpriority + + + The same as EvEmbed::__construct, but doesn't start + the watcher automatically. + + + + + + &reftitle.parameters; + + + other + + + The same as for EvEmbed::__construct + + + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns stopped EvEmbed object on success. + + + + + &reftitle.seealso; + + EvEmbed::__construct + Ev::embeddableBackends + + + + + + diff --git a/reference/ev/evembed/set.xml b/reference/ev/evembed/set.xml new file mode 100644 index 0000000000..6a8479990d --- /dev/null +++ b/reference/ev/evembed/set.xml @@ -0,0 +1,65 @@ + + + + + + EvEmbed::set + Configures the watcher + + + + &reftitle.description; + + public voidEvEmbed::set + objectother + + + Configures the watcher to use other event loop + object. + + + + + + &reftitle.parameters; + + + other + + + The same as for EvEmbed::__construct + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/ev/evembed/sweep.xml b/reference/ev/evembed/sweep.xml new file mode 100644 index 0000000000..dc1400a1ab --- /dev/null +++ b/reference/ev/evembed/sweep.xml @@ -0,0 +1,69 @@ + + + + + + EvEmbed::sweep + The sweep purpose + + + + &reftitle.description; + + public voidEvEmbed::sweep + + + + Make a single, non-blocking sweep over the embedded loop. Works similarly + to the following, but in the most appropriate way for embedded loops: + +start(Ev::RUN_NOWAIT); +?> +]]> + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + EvWatcher::start + + + + + + diff --git a/reference/ev/evfork.xml b/reference/ev/evfork.xml new file mode 100644 index 0000000000..ec50bab9d1 --- /dev/null +++ b/reference/ev/evfork.xml @@ -0,0 +1,86 @@ + + + + + + The EvFork class + EvFork + + + + +
+ &reftitle.intro; + + Fork watchers are called when a fork() was detected + (usually because whoever signalled libev about it by + calling EvLoop::fork). The invocation is done + before the event loop blocks next and before EvCheck + watchers are being called, and only in the child after the fork. Note, that + if whoever calling EvLoop::fork calls it in the + wrong process, the fork handlers will be invoked, too. + +
+ + +
+ &reftitle.classsynopsis; + + + + EvFork + + + + + EvFork + + + + extends + EvWatcher + + + + + &InheritedProperties; + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + +
+ + &reference.ev.entities.evfork; + +
+ + diff --git a/reference/ev/evfork/construct.xml b/reference/ev/evfork/construct.xml new file mode 100644 index 0000000000..18cfc3a3b5 --- /dev/null +++ b/reference/ev/evfork/construct.xml @@ -0,0 +1,91 @@ + + + + + + EvFork::__construct + Constructs the EvFork watcher object + + + + &reftitle.description; + + public EvFork::__construct + callablecallback + mixeddata&null; + intpriority0 + + + Constructs the EvFork watcher object and starts the watcher automatically. + + + + + &reftitle.parameters; + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvFork object on success. + + + + + &reftitle.seealso; + + EvLoop::fork + EvCheck + + + + + + diff --git a/reference/ev/evfork/createstopped.xml b/reference/ev/evfork/createstopped.xml new file mode 100644 index 0000000000..05fe80a679 --- /dev/null +++ b/reference/ev/evfork/createstopped.xml @@ -0,0 +1,90 @@ + + + + + + EvFork::createStopped + Creates a stopped instance of EvFork watcher class + + + + &reftitle.description; + + public static objectEvFork::createStopped + stringcallback + stringdata + stringpriority + + + The same as EvFork::__construct, but doesn't start + the watcher automatically. + + + + + + &reftitle.parameters; + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvFork(stopped) object on success. + + + + + &reftitle.seealso; + + EvFork::__construct + + + + + + diff --git a/reference/ev/evidle.xml b/reference/ev/evidle.xml new file mode 100644 index 0000000000..1b0a0c5008 --- /dev/null +++ b/reference/ev/evidle.xml @@ -0,0 +1,106 @@ + + + + + + The EvIdle class + EvIdle + + + + +
+ &reftitle.intro; + + EvIdle watchers trigger events when no other events + of the same or higher priority are pending + (EvPrepare, EvCheck and other + EvIdle watchers do not count as receiving + events). + + + Thus, as long as your process is busy handling sockets or timeouts(or even + signals) of the same or higher priority it will not be triggered. But when + your process is in idle(or only lower-priority watchers are pending), the + EvIdle watchers are being called once per event loop + iteration - until stopped, that is, or your process receives more events + and becomes busy again with higher priority stuff. + + + Apart from keeping your process non-blocking(which is a useful on its own + sometimes), EvIdle watchers are a good place to do + "pseudo-background processing", or delay processing + stuff to after the event loop has handled all outstanding events. + + + The most noticeable effect is that as long as any idle + watchers are active, the process will not block when + waiting for new events. + + +
+ + +
+ &reftitle.classsynopsis; + + + + EvIdle + + + + + EvIdle + + + + extends + EvWatcher + + + + + &InheritedProperties; + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + + + +
+ + &reference.ev.entities.evidle; + +
+ + diff --git a/reference/ev/evidle/construct.xml b/reference/ev/evidle/construct.xml new file mode 100644 index 0000000000..831af315b4 --- /dev/null +++ b/reference/ev/evidle/construct.xml @@ -0,0 +1,89 @@ + + + + + + EvIdle::__construct + Constructs the EvIdle watcher object + + + + &reftitle.description; + + public EvIdle::__construct + callablecallback + mixeddata + intpriority + + + Constructs the EvIdle watcher object and starts the watcher automatically. + + + + + &reftitle.parameters; + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvIdle object on success. + + + + + &reftitle.seealso; + + EvIdle::createStopped + EvLoop::idle + + + + + + diff --git a/reference/ev/evidle/createstopped.xml b/reference/ev/evidle/createstopped.xml new file mode 100644 index 0000000000..562b8654c7 --- /dev/null +++ b/reference/ev/evidle/createstopped.xml @@ -0,0 +1,90 @@ + + + + + + EvIdle::createStopped + Creates instance of a stopped EvIdle watcher object + + + + &reftitle.description; + + public static objectEvIdle::createStopped + stringcallback + mixeddata + intpriority + + + The same as EvIdle::__construct, but doesn't start + the watcher automatically. + + + + + &reftitle.parameters; + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvIdle object on success. + + + + + &reftitle.seealso; + + EvIdle::__construct + EvLoop::idle + + + + + + diff --git a/reference/ev/evio.xml b/reference/ev/evio.xml new file mode 100644 index 0000000000..adbcbb7674 --- /dev/null +++ b/reference/ev/evio.xml @@ -0,0 +1,139 @@ + + + + + + The EvIo class + EvIo + + + + +
+ &reftitle.intro; + + EvIo watchers check whether a file descriptor(or + socket, or a stream castable to numeric file descriptor) is readable or writable in each + iteration of the event loop, or, more precisely, when reading would not + block the process and writing would at least be able to write some data. + This behaviour is called level-triggering because you keep receiving events + as long as the condition persists. Remember, you can stop the watcher if you + don't want to act on the event and neither want to receive future events. + + + You can register as many read and/or write event watchers per fd as + you want. Setting all file descriptors to non-blocking mode is also usually a + good idea(but not required). + + + Another thing you have to watch out for is that it is quite easy to receive + false readiness notifications, i.e. your callback might be called with + Ev::READ but a subsequent read() + will actually block because there is no data. It is very easy to get into this + situation. Thus it is best to always use non-blocking I/O: An extra + read() returning EAGAIN(or similar) + is far preferable to a program hanging until some data arrives. + + + If you cannot run the fd in non-blocking mode, then + you have to separately re-test whether a file descriptor is really ready. + Some people additionally use SIGALRM and an interval + timer, just to be sure thry won't block infinitely. + + + Always consider using non-blocking mode. + +
+ + +
+ &reftitle.classsynopsis; + + + + EvIo + + + + + EvIo + + + + extends + EvWatcher + + + + &Properties; + + public + fd + + + public + events + + + &InheritedProperties; + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + + +
+ &reftitle.properties; + + + fd + + + + + + events + + + + + +
+ + + +
+ + &reference.ev.entities.evio; + +
+ + diff --git a/reference/ev/evio/construct.xml b/reference/ev/evio/construct.xml new file mode 100644 index 0000000000..e32dc17391 --- /dev/null +++ b/reference/ev/evio/construct.xml @@ -0,0 +1,110 @@ + + + + + + EvIo::__construct + Constructs EvIo watcher object + + + + &reftitle.description; + + public EvIo::__construct + mixedfd + intevents + callablecallback + mixeddata + intpriority + + + Constructs EvIo watcher object and starts the watcher automatically. + + + + + + &reftitle.parameters; + + + fd + + + Can be a stream opened with fopen or similar + functions, numeric file descriptor, or socket. + + + + + events + + + Ev::READ and/or Ev::WRITE. + See the bit masks. + + + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvIo object on success. + + + + + &reftitle.seealso; + + EvIo::createStopped + EvLoop::io + + + + + + diff --git a/reference/ev/evio/createstopped.xml b/reference/ev/evio/createstopped.xml new file mode 100644 index 0000000000..aaed656266 --- /dev/null +++ b/reference/ev/evio/createstopped.xml @@ -0,0 +1,108 @@ + + + + + + EvIo::createStopped + The createStopped purpose + + + + &reftitle.description; + + public static voidEvIo::createStopped + stringfd + stringevents + stringcallback + stringdata + stringpriority + + + The same as EvIo::__construct, but doesn't start + the watcher automatically. + + + + + &reftitle.parameters; + + + fd + + + The same as for EvIo::__construct + + + + + events + + + The same as for EvIo::__construct + + + + + callback + + + See Watcher callbacks. + + + + + data + + + Custom data associated with the watcher. + + + + + priority + + + Watcher priority + + + + + + + + &reftitle.returnvalues; + + Returns EvIo object on success. + + + + + &reftitle.seealso; + + EvIo::__construct + EvLoop::io + + + + + + diff --git a/reference/ev/evio/set.xml b/reference/ev/evio/set.xml new file mode 100644 index 0000000000..fda6c7b71e --- /dev/null +++ b/reference/ev/evio/set.xml @@ -0,0 +1,72 @@ + + + + + + EvIo::set + Configures the watcher + + + + &reftitle.description; + + public voidEvIo::set + mixedfd + intevents + + + Configures the EvIo watcher + + + + + &reftitle.parameters; + + + fd + + + The same as for EvIo::__construct + + + + + events + + + The same as for EvIo::__construct + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/ev/evloop.xml b/reference/ev/evloop.xml new file mode 100644 index 0000000000..0e86983ae8 --- /dev/null +++ b/reference/ev/evloop.xml @@ -0,0 +1,211 @@ + + + + + + The EvLoop class + EvLoop + + + + +
+ &reftitle.intro; + + Represents an event loop that is always distinct from the default + loop. Unlike the default loop, it cannot + handle EvChild watchers. + + + If you are creating threads, you have to create a loop per thread, and use + the the default loop in the parent thread. + + The default event loop is initialized + automatically for you by Ev. You can access it by + means of methods of Ev class, or access the loop + itself via EvLoop::defaultLoop method. +
+ + +
+ &reftitle.classsynopsis; + + + + EvLoop + + + + + final + EvLoop + + + + &Properties; + + public + data + + + public + backend + + + public + is_default_loop + + + public + iteration + + + public + pending + + + public + io_interval + + + public + timeout_interval + + + public + depth + + + + &Methods; + + + + +
+ + + +
+ &reftitle.properties; + + + data + + Custom data attached to loop + + + + backend + + Readonly. + The backend flags + indicating the event backend in use. + + + + is_default_loop + + + Readonly. &true; if it is the default event loop. + + + + + iteration + + The current iteration count of the loop. See + Ev::iteration + + + + pending + + + The number of pending watchers. 0 indicates that + there are no watchers pending. + + + + + io_interval + + + By setting a higher io_interval you allow + libev to spend more time collecting + EvIo events, so you can handle more events per + iteration, at the cost of increasing latency. Timeouts (both + EvPeriodic and EvTimer) + will not be affected. Setting this to a non-zero value will introduce an + additional sleep() call into most loop iterations. + The sleep time ensures that libev will not poll for + EvIo events events more often than once per this + interval, on average. Many programs can usually benefit by setting the + io_interval to a value near 0.1, + which is often enough for interactive servers(not for games). It usually + doesn't make much sense to set it to a lower value than + 0.01, as this approaches the timing granularity of + most systems. Note that if you do transactions with the outside world + and you can’t increase the parallelism, then this setting will limit + your transaction rate (if you need to poll once per transaction and the + io_interval is 0.01, then you + can't do more than 100 transactions per second). + See also FUNCTIONS + CONTROLLING EVENT LOOPS. + + + + + timeout_interval + + + By setting a higher timeout_interval you allow libev + to spend more time collecting timeouts, at the expense of increased + latency/jitter/inexactness(the watcher callback will be called later). + EvIo watchers will not be affected. Setting this to a non-null value + will not introduce any overhead in libev. + + See also FUNCTIONS + CONTROLLING EVENT LOOPS. + + + + + depth + + The recursion depth. See Ev::depth. + + + +
+ + + +
+ + &reference.ev.entities.evloop; + +
+ + diff --git a/reference/ev/evloop/backend.xml b/reference/ev/evloop/backend.xml new file mode 100644 index 0000000000..fdb5d1bbb2 --- /dev/null +++ b/reference/ev/evloop/backend.xml @@ -0,0 +1,65 @@ + + + + + + EvLoop::backend + Returns an integer describing the backend used by libev. + + + + &reftitle.description; + + public intEvLoop::backend + + + + The same as Ev::backend, but for the loop instance. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns an integer describing the backend used by libev. See + Ev::backend. + + + + + &reftitle.seealso; + + + Ev::backend + + + + + + + diff --git a/reference/ev/evloop/check.xml b/reference/ev/evloop/check.xml new file mode 100644 index 0000000000..d0d4722ac5 --- /dev/null +++ b/reference/ev/evloop/check.xml @@ -0,0 +1,66 @@ + + + + + + EvLoop::check + Creates EvCheck object associated with the current event loop + instance + + + + &reftitle.description; + + public EvCheckEvLoop::check + stringcallback + stringdata + stringpriority + + + Creates EvCheck object associated with the current event loop instance. + + + + + + &reftitle.parameters; + All parameters have the same meaning as for + EvCheck::__construct + + + + &reftitle.returnvalues; + + Returns EvCheck object on success. + + + + + &reftitle.seealso; + + EvCheck::__construct + + + + + + diff --git a/reference/ev/evloop/child.xml b/reference/ev/evloop/child.xml new file mode 100644 index 0000000000..a51074ea08 --- /dev/null +++ b/reference/ev/evloop/child.xml @@ -0,0 +1,67 @@ + + + + + + EvLoop::child + Creates EvChild object associated with the current event loop + + + + &reftitle.description; + + public EvChildEvLoop::child + stringpid + stringtrace + stringcallback + stringdata + stringpriority + + + Creates EvChild object associated with the current event loop. + + + + + + &reftitle.parameters; + All parameters have the same meaning as for + EvChild::__construct + + + + &reftitle.returnvalues; + + Returns EvChild object on success. + + + + + &reftitle.seealso; + + EvChild::__construct + + + + + + diff --git a/reference/ev/evloop/construct.xml b/reference/ev/evloop/construct.xml new file mode 100644 index 0000000000..afc7ccee7f --- /dev/null +++ b/reference/ev/evloop/construct.xml @@ -0,0 +1,102 @@ + + + + + + EvLoop::__construct + Constructs the event loop object + + + + &reftitle.description; + + public EvLoop::__construct + intflags + mixeddataNULL + doubleio_interval0.0 + doubletimeout_interval0.0 + + + Constructs the event loop object. + + + + + + &reftitle.parameters; + + + flags + + + One of the + event loop flags + + + + + data + + + Custom data associated with the loop. + + + + + io_interval + + + See io_interval + + + + + timeout_interval + + + See timeout_interval + + + + + + + + &reftitle.returnvalues; + + Returns new EvLoop object. + + + + + &reftitle.seealso; + + EvLoop::defaultLoop + + + + + + diff --git a/reference/ev/evloop/defaultloop.xml b/reference/ev/evloop/defaultloop.xml new file mode 100644 index 0000000000..2b12312373 --- /dev/null +++ b/reference/ev/evloop/defaultloop.xml @@ -0,0 +1,105 @@ + + + + + + EvLoop::defaultLoop + Returns or creates the default event loop. + + + + &reftitle.description; + + public static EvLoopEvLoop::defaultLoop + intflagsEv::FLAG_AUTO + mixeddataNULL + doubleio_interval0. + doubletimeout_interval0. + + + If the default event loop is not created, + EvLoop::defaultLoop creates it with the specified + parameters. Otherwise, it just returns the object representing previously + created instance ignoring all the parameters. + + + + + &reftitle.parameters; + + + flags + + + One of the + event loop flags + + + + + data + + + Custom data to associate with the loop. + + + + + io_collect_interval + + + See io_interval + + + + + timeout_collect_interval + + + See timeout_interval + + + + + + + + &reftitle.returnvalues; + + Returns EvLoop object on success. + + + + + &reftitle.seealso; + + EvLoop::__construct + + + + + + diff --git a/reference/ev/evloop/embed.xml b/reference/ev/evloop/embed.xml new file mode 100644 index 0000000000..8725f33693 --- /dev/null +++ b/reference/ev/evloop/embed.xml @@ -0,0 +1,70 @@ + + + + + + EvLoop::embed + Creates an instance of EvEmbed watcher associated + with the current EvLoop object. + + + + &reftitle.description; + + public EvEmbedEvLoop::embed + stringother + stringcallback + stringdata + stringpriority + + + Creates an instance of EvEmbed watcher associated + with the current EvLoop object. + + + + + + &reftitle.parameters; + + All parameters have the same meaning as for + EvEmbed::__construct. + + + + + &reftitle.returnvalues; + + Returns EvEmbed object on success. + + + + + &reftitle.seealso; + + EvEmbed::__construct + + + + + + diff --git a/reference/ev/evloop/fork.xml b/reference/ev/evloop/fork.xml new file mode 100644 index 0000000000..e9648dbcb0 --- /dev/null +++ b/reference/ev/evloop/fork.xml @@ -0,0 +1,70 @@ + + + + + + EvLoop::fork + Creates EvFork watcher object associated with the current event + loop instance + + + + &reftitle.description; + + public EvForkEvLoop::fork + callablecallback + mixeddata&null; + intpriority0 + + + Creates EvFork watcher object associated with the current event + loop instance + + + + + + &reftitle.parameters; + + All parameters have the same meaning as for EvFork::__construct + + + + + &reftitle.returnvalues; + + Returns EvFork object on success. + + + + + &reftitle.seealso; + + EvFork::__construct + + + + + + diff --git a/reference/ev/evloop/idle.xml b/reference/ev/evloop/idle.xml new file mode 100644 index 0000000000..a503239765 --- /dev/null +++ b/reference/ev/evloop/idle.xml @@ -0,0 +1,69 @@ + + + + + + EvLoop::idle + Creates EvIdle watcher object associated with the current event + loop instance + + + + &reftitle.description; + + public EvIdleEvLoop::idle + callablecallback + mixeddata&null; + intpriority0 + + + Creates EvIdle watcher object associated with the current event + loop instance + + + + + + &reftitle.parameters; + All the parameters have the same meaning as for + EvIdle::__construct + + + + &reftitle.returnvalues; + + Returns EvIdle object on success. + + + + + &reftitle.seealso; + + EvIdle::__construct + + + + + + diff --git a/reference/ev/evloop/invokepending.xml b/reference/ev/evloop/invokepending.xml new file mode 100644 index 0000000000..ed3fb8d669 --- /dev/null +++ b/reference/ev/evloop/invokepending.xml @@ -0,0 +1,55 @@ + + + + + + EvLoop::invokePending + Invoke all pending watchers while resetting their pending state + + + + &reftitle.description; + + public voidEvLoop::invokePending + + + + Invoke all pending watchers while resetting their pending state. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/ev/evloop/io.xml b/reference/ev/evloop/io.xml new file mode 100644 index 0000000000..0b3b9fd917 --- /dev/null +++ b/reference/ev/evloop/io.xml @@ -0,0 +1,71 @@ + + + + + + EvLoop::io + Create EvIo watcher object associated with the current event + loop instance + + + + &reftitle.description; + + public EvIoEvLoop::io + mixedfd + intevents + callablecallback + mixeddata&null; + intpriority0 + + + Create EvIo watcher object associated with the current event + loop instance. + + + + + + &reftitle.parameters; + All parameters have the same meaning as for + EvIo::__construct + + + + &reftitle.returnvalues; + + Returns EvIo object on success. + + + + + &reftitle.seealso; + + EvIo::__construct + + + + + + diff --git a/reference/ev/evloop/loopfork.xml b/reference/ev/evloop/loopfork.xml new file mode 100644 index 0000000000..0e573c8ee7 --- /dev/null +++ b/reference/ev/evloop/loopfork.xml @@ -0,0 +1,60 @@ + + + + + + EvLoop::loopFork + Must be called after a fork + + + + &reftitle.description; + + public voidEvLoop::loopFork + + + + Must be called after a fork in the child, before + entering or continuing the event loop. An alternative is to use + Ev::FLAG_FORKCHECK which calls this function + automatically, at some performance loss (refer to the libev + documentation). + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + + diff --git a/reference/ev/evloop/now.xml b/reference/ev/evloop/now.xml new file mode 100644 index 0000000000..f3126efe4f --- /dev/null +++ b/reference/ev/evloop/now.xml @@ -0,0 +1,66 @@ + + + + + + EvLoop::now + Returns the current "event loop time" + + + + &reftitle.description; + + public doubleEvLoop::now + + + + Returns the current "event loop time", which is the time the event loop + received events and started processing them. This timestamp does not change + as long as callbacks are being processed, and this is also the base time + used for relative timers. You can treat it as the timestamp of the event + occurring(or more correctly, libev finding out about it). + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns time of the event loop in (fractional) seconds. + + + + + &reftitle.seealso; + + Ev::now + + + + + + diff --git a/reference/ev/evloop/nowupdate.xml b/reference/ev/evloop/nowupdate.xml new file mode 100644 index 0000000000..e22beaa355 --- /dev/null +++ b/reference/ev/evloop/nowupdate.xml @@ -0,0 +1,67 @@ + + + + + + EvLoop::nowUpdate + Establishes the current time by querying the kernel, updating the time + returned by EvLoop::now in the progress. + + + + &reftitle.description; + + public voidEvLoop::nowUpdate + + + + Establishes the current time by querying the kernel, updating the time + returned by EvLoop::now in the progress. This is a + costly operation and is usually done automatically within + EvLoop::run. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + EvLoop::now + Ev::nowUpdate + + + + + + diff --git a/reference/ev/evloop/periodic.xml b/reference/ev/evloop/periodic.xml new file mode 100644 index 0000000000..b31834b462 --- /dev/null +++ b/reference/ev/evloop/periodic.xml @@ -0,0 +1,71 @@ + + + + + + EvLoop::periodic + Creates EvPeriodic watcher object associated with the current + event loop instance + + + + &reftitle.description; + + public EvPeriodicEvLoop::periodic + doubleoffset + doubleinterval + callablecallback + mixeddata&null; + intpriority0 + + + Creates EvPeriodic watcher object associated with the current + event loop instance + + + + + + &reftitle.parameters; + All parameters have the same maening as for + EvPeriodic::__construct + + + + &reftitle.returnvalues; + + Returns EvPeriodic object on success. + + + + + &reftitle.seealso; + + EvPeriodic::__construct + + + + + + diff --git a/reference/ev/evloop/prepare.xml b/reference/ev/evloop/prepare.xml new file mode 100644 index 0000000000..8e6f9db745 --- /dev/null +++ b/reference/ev/evloop/prepare.xml @@ -0,0 +1,69 @@ + + + + + + EvLoop::prepare + Creates EvPrepare watcher object associated with the current + event loop instance + + + + &reftitle.description; + + public EvPrepareEvLoop::prepare + callablecallback + mixeddata&null; + intpriority0 + + + Creates EvPrepare watcher object associated with the current + event loop instance + + + + + + &reftitle.parameters; + All parameters have the same maening as for + EvPrepare + + + + &reftitle.returnvalues; + + Returns EvPrepare object on success + + + + + &reftitle.seealso; + + EvPrepare::__construct + + + + + + diff --git a/reference/ev/evloop/resume.xml b/reference/ev/evloop/resume.xml new file mode 100644 index 0000000000..30f78ce9e6 --- /dev/null +++ b/reference/ev/evloop/resume.xml @@ -0,0 +1,65 @@ + + + + + + EvLoop::resume + Resume previously suspended default event loop + + + + &reftitle.description; + + public voidEvLoop::resume + + + + EvLoop::suspend and + EvLoop::resume methods suspend and resume a loop + correspondingly. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + EvLoop::suspend + Ev::resume + + + + + + diff --git a/reference/ev/evloop/run.xml b/reference/ev/evloop/run.xml new file mode 100644 index 0000000000..c71d6061ee --- /dev/null +++ b/reference/ev/evloop/run.xml @@ -0,0 +1,112 @@ + + + + + + EvLoop::run + Begin checking for events and calling callbacks for the loop + + + + &reftitle.description; + + public voidEvLoop::run + intflags0 + + + Begin checking for events and calling callbacks for the current event loop. + Returns when a callback calls Ev::stop method, or + the flags are nonzero(in which case the return value is true) or when there + are no active watchers which reference the + loop(EvWatcher::keepalive is &true;), in which case + the return value will be &false;. The return value can generally be + interpreted as if &true;, there is more work left + to do. + + + + + + &reftitle.parameters; + + + flags + + + Optional parameter flags can be one of the following: + + + List for possible values of <parameter>flags</parameter> + + + + + flags + Description + + + + + 0 + The default behavior described above + + + Ev::RUN_ONCE + Block at most one(wait, but don't loop) + + + Ev::RUN_NOWAIT + Don't block at all(fetch/handle events, but don't wait) + + + +
+
+ + See the run flag + constants. + +
+ +
+
+
+ + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + EvLoop::stop + Ev::run + + + +
+ + diff --git a/reference/ev/evloop/signal.xml b/reference/ev/evloop/signal.xml new file mode 100644 index 0000000000..e1f15c5770 --- /dev/null +++ b/reference/ev/evloop/signal.xml @@ -0,0 +1,70 @@ + + + + + + EvLoop::signal + Creates EvSignal watcher object associated with the current + event loop instance + + + + &reftitle.description; + + public EvSignalEvLoop::signal + intsignum + callablecallback + mixeddata&null; + intpriority0 + + + Creates EvSignal watcher object associated with the current + event loop instance + + + + + + &reftitle.parameters; + All parameters have the same meaning as for + EvSignal::__construct + + + + &reftitle.returnvalues; + + Returns EvSignal object on success + + + + + &reftitle.seealso; + + EvSignal::__construct + + + + + + diff --git a/reference/ev/evloop/stat.xml b/reference/ev/evloop/stat.xml new file mode 100644 index 0000000000..f37845a2bf --- /dev/null +++ b/reference/ev/evloop/stat.xml @@ -0,0 +1,71 @@ + + + + + + EvLoop::stat + Creates EvStat watcher object associated with the current event + loop instance + + + + &reftitle.description; + + public EvStatEvLoop::stat + stringpath + doubleinterval + callablecallback + mixeddata&null; + intpriority0 + + + Creates EvStat watcher object associated with the current event + loop instance + + + + + + &reftitle.parameters; + All parameters have the same meaning as for + EvSignal::__construct + + + + &reftitle.returnvalues; + + Returns EvStat object on success + + + + + &reftitle.seealso; + + EvSignal::__construct + + + + + + diff --git a/reference/ev/evloop/stop.xml b/reference/ev/evloop/stop.xml new file mode 100644 index 0000000000..27e0eb0e28 --- /dev/null +++ b/reference/ev/evloop/stop.xml @@ -0,0 +1,73 @@ + + + + + + EvLoop::stop + Stops the event loop + + + + &reftitle.description; + + public voidEvLoop::stop + inthow + + + Stops the event loop + + + + + + &reftitle.parameters; + + + how + + + One of Ev::BREAK_* constants. + + + + + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + EvLoop::run + Ev::stop + + + + + + diff --git a/reference/ev/evloop/suspend.xml b/reference/ev/evloop/suspend.xml new file mode 100644 index 0000000000..2594997485 --- /dev/null +++ b/reference/ev/evloop/suspend.xml @@ -0,0 +1,65 @@ + + + + + + EvLoop::suspend + Suspend the loop + + + + &reftitle.description; + + public voidEvLoop::suspend + + + + EvLoop::suspend and + EvLoop::resume methods suspend and resume a loop + correspondingly. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + EvLoop::resume + Ev::suspend + + + + + + diff --git a/reference/ev/evloop/timer.xml b/reference/ev/evloop/timer.xml new file mode 100644 index 0000000000..081077277b --- /dev/null +++ b/reference/ev/evloop/timer.xml @@ -0,0 +1,72 @@ + + + + + + EvLoop::timer + Creates EvTimer watcher object associated with the current event + loop instance + + + + &reftitle.description; + + public EvTimerEvLoop::timer + doubleafter + doublerepeat + callablecallback + mixeddata&null; + intpriority0 + + + Creates EvTimer watcher object associated with the current event + loop instance + + + + + + &reftitle.parameters; + All parameters have the same meaning as for + EvTimer::__construct + + + + &reftitle.returnvalues; + + Returns EvTimer object on success + + + + + + &reftitle.seealso; + + EvTimer::__construct + + + + + + diff --git a/reference/ev/evloop/verify.xml b/reference/ev/evloop/verify.xml new file mode 100644 index 0000000000..63d0275f01 --- /dev/null +++ b/reference/ev/evloop/verify.xml @@ -0,0 +1,64 @@ + + + + + + EvLoop::verify + Performs internal consistency checks(for debugging) + + + + &reftitle.description; + + public voidEvLoop::verify + + + + Performs internal consistency checks(for debugging + libev) and abort the program if any data structures + were found to be corrupted. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + Ev::verify + + + + + + diff --git a/reference/ev/evperiodic.xml b/reference/ev/evperiodic.xml new file mode 100644 index 0000000000..34d842e3ce --- /dev/null +++ b/reference/ev/evperiodic.xml @@ -0,0 +1,151 @@ + + + + + + The EvPeriodic class + EvPeriodic + + + + +
+ &reftitle.intro; + + Periodic watchers are also timers of a kind, but they are very versatile. + + + + Unlike EvTimer, EvPeriodic + watchers are not based on real time(or relative time, the physical time + that passes) but on wall clock time(absolute time, calendar or clock). The + difference is that wall clock time can run faster or slower than real time, + and time jumps are not uncommon(e.g. when you adjust it). + + + + You can tell a EvPeriodic watcher to trigger after + some specific point in time: for example, if you tell a + EvPeriodic watcher to trigger "in 10 + seconds" (by specifying e.g. + EvLoop::now + 10.0, that + is, an absolute time not a delay) and then reset your system clock to + January of the previous year, then it will take a year + or more to trigger the event (unlike an EvTimer, + which would still trigger roughly 10 seconds after + starting it, as it uses a relative timeout). + + + + As with timers, the callback is guaranteed to be invoked only when the + point in time where it is supposed to trigger has passed. If multiple + timers become ready during the same loop iteration then the ones with + earlier time-out values are invoked before ones with later time-out values + (but this is no longer true when a callback calls + EvLoop::run recursively). + + +
+ + +
+ &reftitle.classsynopsis; + + + + EvPeriodic + + + + + EvPeriodic + + + + extends + EvWatcher + + + + &Properties; + + public + offset + + + public + interval + + + &InheritedProperties; + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + + +
+ &reftitle.properties; + + + offset + + + When repeating, this contains the offset value, otherwise this is the + absolute point in time(the offset value passed to + EvPeriodic::set, although + libev might modify this value for better numerical + stability). + + + + + interval + + + The current interval value. Can be modified any time, but changes only + take effect when the periodic timer fires or + EvPeriodic::again is being called. + + + + +
+ + + +
+ + &reference.ev.entities.evperiodic; + +
+ + diff --git a/reference/ev/evperiodic/again.xml b/reference/ev/evperiodic/again.xml new file mode 100644 index 0000000000..fcd7fdf13f --- /dev/null +++ b/reference/ev/evperiodic/again.xml @@ -0,0 +1,63 @@ + + + + + + EvPeriodic::again + Simply stops and restarts the periodic watcher again. + + + + &reftitle.description; + + public voidEvPeriodic::again + + + + Simply stops and restarts the periodic watcher again. This is only useful + when you changed some attributes. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + EvTimer::again + + + + + + diff --git a/reference/ev/evperiodic/at.xml b/reference/ev/evperiodic/at.xml new file mode 100644 index 0000000000..09479f99da --- /dev/null +++ b/reference/ev/evperiodic/at.xml @@ -0,0 +1,61 @@ + + + + + + EvPeriodic::at + Returns the absolute time that this + watcher is supposed to trigger next + + + + &reftitle.description; + + public doubleEvPeriodic::at + + + + When the watcher is active, returns the absolute time that this + watcher is supposed to trigger next. This is not the same as the offset + argument to EvPeriodic::set or + EvPeriodic::__construct, but indeed works even in + interval mode. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the absolute time this watcher is supposed to trigger next in + seconds. + + + + + + diff --git a/reference/ev/evperiodic/construct.xml b/reference/ev/evperiodic/construct.xml new file mode 100644 index 0000000000..d8b3919f61 --- /dev/null +++ b/reference/ev/evperiodic/construct.xml @@ -0,0 +1,143 @@ + + + + + + EvPeriodic::__construct + Constructs EvPeriodic watcher object + + + + &reftitle.description; + + public EvPeriodic::__construct + doubleoffset + stringinterval + callablereschedule_cb + stringcallback + stringdata + stringpriority + + + Constructs EvPeriodic watcher object + + + + + + &reftitle.parameters; + + + offset + + + See Periodic watcher operation + modes + + + + + interval + + + See Periodic watcher operation + modes + + + + + reschedule_cb + + + Rescheduler callback. You can pass &null;. + See Periodic watcher operation + modes + + + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvPeriodic::__construct</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evperiodic/createstopped.xml b/reference/ev/evperiodic/createstopped.xml new file mode 100644 index 0000000000..62ad7fb2bf --- /dev/null +++ b/reference/ev/evperiodic/createstopped.xml @@ -0,0 +1,132 @@ + + + + + + EvPeriodic::createStopped + The createStopped purpose + + + + &reftitle.description; + + public static voidEvPeriodic::createStopped + stringoffset + stringinterval + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + offset + + + + + + + + interval + + + + + + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvPeriodic::createStopped</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evperiodic/set.xml b/reference/ev/evperiodic/set.xml new file mode 100644 index 0000000000..f6dd184c68 --- /dev/null +++ b/reference/ev/evperiodic/set.xml @@ -0,0 +1,105 @@ + + + + + + EvPeriodic::set + The set purpose + + + + &reftitle.description; + + public voidEvPeriodic::set + stringoffset + stringinterval + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + offset + + + + + + + + interval + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvPeriodic::set</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evprepare.xml b/reference/ev/evprepare.xml new file mode 100644 index 0000000000..e55cbc11a0 --- /dev/null +++ b/reference/ev/evprepare.xml @@ -0,0 +1,76 @@ + + + + + + The EvPrepare class + EvPrepare + + + + +
+ +
+ + +
+ &reftitle.classsynopsis; + + + + EvPrepare + + + + + EvPrepare + + + + extends + EvWatcher + + + + + &InheritedProperties; + + + &Methods; + + + &InheritedMethods; + + + + + +
+ +
+ + &reference.ev.entities.evprepare; + +
+ + diff --git a/reference/ev/evprepare/construct.xml b/reference/ev/evprepare/construct.xml new file mode 100644 index 0000000000..6e0e3c098d --- /dev/null +++ b/reference/ev/evprepare/construct.xml @@ -0,0 +1,114 @@ + + + + + + EvPrepare::__construct + The __construct purpose + + + + &reftitle.description; + + public EvPrepare::__construct + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvPrepare::__construct</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evprepare/createstopped.xml b/reference/ev/evprepare/createstopped.xml new file mode 100644 index 0000000000..89c68218f3 --- /dev/null +++ b/reference/ev/evprepare/createstopped.xml @@ -0,0 +1,114 @@ + + + + + + EvPrepare::createStopped + The createStopped purpose + + + + &reftitle.description; + + public static objectEvPrepare::createStopped + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvPrepare::createStopped</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evsignal.xml b/reference/ev/evsignal.xml new file mode 100644 index 0000000000..e7335f8c57 --- /dev/null +++ b/reference/ev/evsignal.xml @@ -0,0 +1,122 @@ + + + + + + The EvSignal class + EvSignal + + + + +
+ &reftitle.intro; + + + +
+ + +
+ &reftitle.classsynopsis; + + + + EvSignal + + + + + EvSignal + + + + extends + EvWatcher + + + + &Properties; + + public + signum + + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + + +
+ &reftitle.properties; + + + is_active + + + + + + data + + + + + + is_pending + + + + + + priority + + + + + + signum + + + + + +
+ + + +
+ + &reference.ev.entities.evsignal; + +
+ + diff --git a/reference/ev/evsignal/construct.xml b/reference/ev/evsignal/construct.xml new file mode 100644 index 0000000000..59f265699c --- /dev/null +++ b/reference/ev/evsignal/construct.xml @@ -0,0 +1,123 @@ + + + + + + EvSignal::__construct + The __construct purpose + + + + &reftitle.description; + + public EvSignal::__construct + stringsignum + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + signum + + + + + + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvSignal::__construct</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evsignal/createstopped.xml b/reference/ev/evsignal/createstopped.xml new file mode 100644 index 0000000000..5f03f15177 --- /dev/null +++ b/reference/ev/evsignal/createstopped.xml @@ -0,0 +1,123 @@ + + + + + + EvSignal::createStopped + The createStopped purpose + + + + &reftitle.description; + + public static voidEvSignal::createStopped + stringsignum + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + signum + + + + + + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvSignal::createStopped</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evsignal/set.xml b/reference/ev/evsignal/set.xml new file mode 100644 index 0000000000..7cab765502 --- /dev/null +++ b/reference/ev/evsignal/set.xml @@ -0,0 +1,96 @@ + + + + + + EvSignal::set + The set purpose + + + + &reftitle.description; + + public voidEvSignal::set + stringsignum + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + signum + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvSignal::set</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evstat.xml b/reference/ev/evstat.xml new file mode 100644 index 0000000000..32ceead6fc --- /dev/null +++ b/reference/ev/evstat.xml @@ -0,0 +1,132 @@ + + + + + + The EvStat class + EvStat + + + + +
+ &reftitle.intro; + + + +
+ + +
+ &reftitle.classsynopsis; + + + + EvStat + + + + + EvStat + + + + extends + EvWatcher + + + + &Properties; + + public + path + + + public + interval + + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + + +
+ &reftitle.properties; + + + is_active + + + + + + data + + + + + + is_pending + + + + + + priority + + + + + + path + + + + + + interval + + + + + +
+ + + +
+ + &reference.ev.entities.evstat; + +
+ + diff --git a/reference/ev/evstat/attr.xml b/reference/ev/evstat/attr.xml new file mode 100644 index 0000000000..df7f59358a --- /dev/null +++ b/reference/ev/evstat/attr.xml @@ -0,0 +1,87 @@ + + + + + + EvStat::attr + The attr purpose + + + + &reftitle.description; + + public voidEvStat::attr + + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvStat::attr</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evstat/construct.xml b/reference/ev/evstat/construct.xml new file mode 100644 index 0000000000..9759724e6e --- /dev/null +++ b/reference/ev/evstat/construct.xml @@ -0,0 +1,132 @@ + + + + + + EvStat::__construct + The __construct purpose + + + + &reftitle.description; + + public EvStat::__construct + stringpath + stringinterval + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + path + + + + + + + + interval + + + + + + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvStat::__construct</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evstat/createstopped.xml b/reference/ev/evstat/createstopped.xml new file mode 100644 index 0000000000..359909b6fa --- /dev/null +++ b/reference/ev/evstat/createstopped.xml @@ -0,0 +1,132 @@ + + + + + + EvStat::createStopped + The createStopped purpose + + + + &reftitle.description; + + public static voidEvStat::createStopped + stringpath + stringinterval + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + path + + + + + + + + interval + + + + + + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvStat::createStopped</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evstat/prev.xml b/reference/ev/evstat/prev.xml new file mode 100644 index 0000000000..d6f4369483 --- /dev/null +++ b/reference/ev/evstat/prev.xml @@ -0,0 +1,87 @@ + + + + + + EvStat::prev + The prev purpose + + + + &reftitle.description; + + public voidEvStat::prev + + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvStat::prev</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evstat/set.xml b/reference/ev/evstat/set.xml new file mode 100644 index 0000000000..c81295f361 --- /dev/null +++ b/reference/ev/evstat/set.xml @@ -0,0 +1,105 @@ + + + + + + EvStat::set + The set purpose + + + + &reftitle.description; + + public voidEvStat::set + stringpath + stringinterval + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + path + + + + + + + + interval + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvStat::set</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evstat/stat.xml b/reference/ev/evstat/stat.xml new file mode 100644 index 0000000000..919b03b7eb --- /dev/null +++ b/reference/ev/evstat/stat.xml @@ -0,0 +1,87 @@ + + + + + + EvStat::stat + The stat purpose + + + + &reftitle.description; + + public voidEvStat::stat + + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvStat::stat</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evtimer.xml b/reference/ev/evtimer.xml new file mode 100644 index 0000000000..fe3aa8b2c6 --- /dev/null +++ b/reference/ev/evtimer.xml @@ -0,0 +1,132 @@ + + + + + + The EvTimer class + EvTimer + + + + +
+ &reftitle.intro; + + + +
+ + +
+ &reftitle.classsynopsis; + + + + EvTimer + + + + + EvTimer + + + + extends + EvWatcher + + + + &Properties; + + public + repeat + + + public + remaining + + + + &Methods; + + + &InheritedMethods; + + + + + +
+ + + +
+ &reftitle.properties; + + + is_active + + + + + + data + + + + + + is_pending + + + + + + priority + + + + + + repeat + + + + + + remaining + + + + + +
+ + + +
+ + &reference.ev.entities.evtimer; + +
+ + diff --git a/reference/ev/evtimer/again.xml b/reference/ev/evtimer/again.xml new file mode 100644 index 0000000000..64338e0288 --- /dev/null +++ b/reference/ev/evtimer/again.xml @@ -0,0 +1,87 @@ + + + + + + EvTimer::again + The again purpose + + + + &reftitle.description; + + public voidEvTimer::again + + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvTimer::again</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evtimer/construct.xml b/reference/ev/evtimer/construct.xml new file mode 100644 index 0000000000..5429fa21f4 --- /dev/null +++ b/reference/ev/evtimer/construct.xml @@ -0,0 +1,132 @@ + + + + + + EvTimer::__construct + The __construct purpose + + + + &reftitle.description; + + public EvTimer::__construct + stringafter + stringrepeat + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + after + + + + + + + + repeat + + + + + + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvTimer::__construct</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evtimer/createstopped.xml b/reference/ev/evtimer/createstopped.xml new file mode 100644 index 0000000000..2aaa1eec2e --- /dev/null +++ b/reference/ev/evtimer/createstopped.xml @@ -0,0 +1,132 @@ + + + + + + EvTimer::createStopped + The createStopped purpose + + + + &reftitle.description; + + public static voidEvTimer::createStopped + stringafter + stringrepeat + stringcallback + stringdata + stringpriority + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + after + + + + + + + + repeat + + + + + + + + callback + + + + + + + + data + + + + + + + + priority + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvTimer::createStopped</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evtimer/set.xml b/reference/ev/evtimer/set.xml new file mode 100644 index 0000000000..dc1bc7f6e3 --- /dev/null +++ b/reference/ev/evtimer/set.xml @@ -0,0 +1,105 @@ + + + + + + EvTimer::set + The set purpose + + + + &reftitle.description; + + public voidEvTimer::set + stringafter + stringrepeat + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + after + + + + + + + + repeat + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvTimer::set</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher.xml b/reference/ev/evwatcher.xml new file mode 100644 index 0000000000..56dc250755 --- /dev/null +++ b/reference/ev/evwatcher.xml @@ -0,0 +1,130 @@ + + + + + + The EvWatcher class + EvWatcher + + + + +
+ &reftitle.intro; + + + +
+ + +
+ &reftitle.classsynopsis; + + + + EvWatcher + + + + + abstract + EvWatcher + + + + &Properties; + + public + is_active + + + public + data + + + public + is_pending + + + public + priority + + + + &Methods; + + + + +
+ + + +
+ &reftitle.properties; + + + is_active + + Readonly. &true; if the watcher is active. + &false; otherwise. + + + + data + + User custom data associated with the watcher + + + + is_pending + + Readonly.&true; if the watcher is pending, + i.e. it has outstanding events, but its callback has not yet been invoked. + &false; otherwise. As long, as a watcher is pending(but not active), you + must not change its priority. + + + + priority + + Integer between EV_MINPRI and + EV_MAXPRI. Pending watchers with higher priority + will be invoked before watchers with lower priority, but priority will + not keep watchers from being executed(except for + EvIdle watchers). If you need to suppress + invocation when higher priority events are pending you need to look at + EvIdle watchers, which provide this functionality. + + + +
+ + + +
+ + &reference.ev.entities.evwatcher; + +
+ + diff --git a/reference/ev/evwatcher/clear.xml b/reference/ev/evwatcher/clear.xml new file mode 100644 index 0000000000..f3929f9269 --- /dev/null +++ b/reference/ev/evwatcher/clear.xml @@ -0,0 +1,87 @@ + + + + + + EvWatcher::clear + The clear purpose + + + + &reftitle.description; + + public voidEvWatcher::clear + + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::clear</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher/construct.xml b/reference/ev/evwatcher/construct.xml new file mode 100644 index 0000000000..ce6a717624 --- /dev/null +++ b/reference/ev/evwatcher/construct.xml @@ -0,0 +1,86 @@ + + + + + + EvWatcher::__construct + Abstract constructor of a watcher object + + + + &reftitle.description; + + abstract public EvWatcher::__construct + + + + EvWatcher::__construct is an abstract constructor + of a watcher object implemented in the derived classes. + + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::__construct</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher/feed.xml b/reference/ev/evwatcher/feed.xml new file mode 100644 index 0000000000..c68bea99c5 --- /dev/null +++ b/reference/ev/evwatcher/feed.xml @@ -0,0 +1,96 @@ + + + + + + EvWatcher::feed + The feed purpose + + + + &reftitle.description; + + public voidEvWatcher::feed + stringrevents + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + revents + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::feed</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher/getloop.xml b/reference/ev/evwatcher/getloop.xml new file mode 100644 index 0000000000..ddf3439435 --- /dev/null +++ b/reference/ev/evwatcher/getloop.xml @@ -0,0 +1,87 @@ + + + + + + EvWatcher::getLoop + The getLoop purpose + + + + &reftitle.description; + + public voidEvWatcher::getLoop + + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::getLoop</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher/invoke.xml b/reference/ev/evwatcher/invoke.xml new file mode 100644 index 0000000000..41d4361cb0 --- /dev/null +++ b/reference/ev/evwatcher/invoke.xml @@ -0,0 +1,96 @@ + + + + + + EvWatcher::invoke + The invoke purpose + + + + &reftitle.description; + + public voidEvWatcher::invoke + stringrevents + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + revents + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::invoke</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher/keepalive.xml b/reference/ev/evwatcher/keepalive.xml new file mode 100644 index 0000000000..1274c8cbde --- /dev/null +++ b/reference/ev/evwatcher/keepalive.xml @@ -0,0 +1,96 @@ + + + + + + EvWatcher::keepalive + The keepalive purpose + + + + &reftitle.description; + + public voidEvWatcher::keepalive + stringvalue + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + value + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::keepalive</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher/setcallback.xml b/reference/ev/evwatcher/setcallback.xml new file mode 100644 index 0000000000..122622e364 --- /dev/null +++ b/reference/ev/evwatcher/setcallback.xml @@ -0,0 +1,96 @@ + + + + + + EvWatcher::setCallback + The setCallback purpose + + + + &reftitle.description; + + public voidEvWatcher::setCallback + stringcallback + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + + + callback + + + + + + + + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::setCallback</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher/start.xml b/reference/ev/evwatcher/start.xml new file mode 100644 index 0000000000..2ec1b180f1 --- /dev/null +++ b/reference/ev/evwatcher/start.xml @@ -0,0 +1,87 @@ + + + + + + EvWatcher::start + The start purpose + + + + &reftitle.description; + + public voidEvWatcher::start + + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::start</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/evwatcher/stop.xml b/reference/ev/evwatcher/stop.xml new file mode 100644 index 0000000000..d4abb47b26 --- /dev/null +++ b/reference/ev/evwatcher/stop.xml @@ -0,0 +1,87 @@ + + + + + + EvWatcher::stop + The stop purpose + + + + &reftitle.description; + + public voidEvWatcher::stop + + + + + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + + + + + + &reftitle.examples; + + <function>EvWatcher::stop</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + + + + + + + diff --git a/reference/ev/examples.xml b/reference/ev/examples.xml new file mode 100644 index 0000000000..6a8988f436 --- /dev/null +++ b/reference/ev/examples.xml @@ -0,0 +1,443 @@ + + + + + &reftitle.examples; + + Simple timers + +stop(); + // Stop the watcher if further calls cause more than 10 iterations + Ev::iteration() >= 10 and $w->stop(); +}); + +// Create stopped timer. It will be inactive until we start it ourselves +$w_stopped = EvTimer::createStopped(10, 5, function($w) { + echo "Callback of a timer created as stopped\n"; + + // Stop the watcher after 2 iterations + Ev::iteration() >= 2 and $w->stop(); +}); + +// Loop until Ev::stop() is called or all of watchers stop +Ev::run(); + +// Start and look if it works +$w_stopped->start(); +echo "Run single iteration\n"; +Ev::run(Ev::RUN_ONCE); + +echo "Restart the second watcher and try to handle the same events, but don't block\n"; +$w2->again(); +Ev::run(Ev::RUN_NOWAIT); + +$w = new EvTimer(10, 0, function() {}); +echo "Running a blocking loop\n"; +Ev::run(); +echo "END\n"; +?> +]]> + + &example.outputs.similar; + + + + + + + Periodic timer. Tick each 10.5 seconds + + +]]> + + + + + Periodic timer. Use reschedule callback + + + +]]> + + + + + Periodic timer. Tick every 10.5 seconds starting at now + + +]]> + + + + + Wait until STDIN is readable + + +]]> + + + + + Use some async I/O to access a socket + +stop(); + // Stop write watcher + $w->stop(); + + $in = "HEAD / HTTP/1.1\r\n"; + $in .= "Host: google.co.uk\r\n"; + $in .= "Connection: Close\r\n\r\n"; + + if (!socket_write($socket, $in, strlen($in))) { + trigger_error("Failed writing $in to socket", E_USER_ERROR); + } + + $read_watcher = new EvIo($socket, Ev::READ, function ($w, $re) + use ($socket, $e_nonblocking) { + // Socket is readable. recv() 20 bytes using non-blocking mode + $ret = socket_recv($socket, $out, 20, MSG_DONTWAIT); + + if ($ret) { + echo $out; + } elseif ($ret === 0) { + // All read + $w->stop(); + socket_close($socket); + return; + } + + // Caught EINPROGRESS, EAGAIN, or EWOULDBLOCK + if (in_array(socket_last_error(), $e_nonblocking)) { + return; + } + + $w->stop(); + socket_close($socket); + }); + + Ev::run(); +}); + +$result = socket_connect($socket, $address, $service_port); + +Ev::run(); +?> +]]> + + &example.outputs.similar; + + + + + + + Embedding one loop into another + + +]]> + + + + + Embedding loop created with kqueue backend into the default loop + + +]]> + + + + + Handle SIGTERM signal + +stop(); +}); +Ev::run(); +?> +]]> + + + + + Monitor changes of /var/log/messages + +attr(); + + if ($attr['nlink']) { + printf("Current size: %ld\n", $attr['size']); + printf("Current atime: %ld\n", $attr['atime']); + printf("Current mtime: %ld\n", $attr['mtime']); + } else { + fprintf(STDERR, "`messages` file is not there!"); + $w->stop(); + } +}); + +Ev::run(); +?> +]]> + + + + + Monotor changes of /var/log/messages. Avoid missing updates by means of one second delay + +stop(); + + $stat = $w->data; + + // 1 second after the most recent change of the file + printf("Current size: %ld\n", $stat->attr()['size']); +}); + +$stat = new EvStat("/var/log/messages", 0., function () use ($timer) { + // Reset timer watcher + $timer->again(); +}); + +$timer->data = $stat; + +Ev::run(); +?> +]]> + + + + + Process status changes + +stop(); + + printf("Process %d exited with status %d\n", $w->rpid, $w->rstatus); + }); + + Ev::run(); + + // Protect against Zombies + pcntl_wait($status); +} else { + //Forked child + exit(2); +} +?> +]]> + + + + + + diff --git a/reference/ev/periodic-modes.xml b/reference/ev/periodic-modes.xml new file mode 100644 index 0000000000..3ef9ba2a98 --- /dev/null +++ b/reference/ev/periodic-modes.xml @@ -0,0 +1,120 @@ + + + Periodic watcher operation modes + + + EvPeriodic watcher works in different modes depending + on the offset, interval and + reschedule_cb parameters. + + + + + Absolute timer. + In this mode interval = 0, reschedule_cb = &null;. + This time simply fires at the wallclock time offset and doesn't repeat. It will + not adjust when a time jump occurs, that is, if it is to be run at January + 1st 2014 then it will run when the system time reaches or surpasses this + time. + + + + Repeating interval timer. + In this mode interval > 0, reschedule_cb = &null;; + the watcher will always be scheduled to timeout at the next offset + N * + interval time(for some integer N) and then repeat, regardless of any time + jumps. + + + This can be used to create timers that do not drift with respect to system time: + + +]]> + + That doesn't mean there will always be 3600 seconds in + between triggers, but only that the the callback will be called when the + system time shows a full hour(UTC). + + + EvPeriodic will try to run the callback in this mode + at the next possible time where time = + offset (mod + interval), regardless of any time jumps. + + + + Manual reschedule mode. + In this mode reschedule_cb is a + callable. + + + interval and offset are both + being ignored. Instead, each time the periodic watcher gets scheduled, the + reschedule callback (reschedule_cb) will be called + with the watcher as first, and the current time as second argument. + + + This callback must not stop or destroy this or any other + periodic watchers, ever, and must not call any event loop + functions or methods. If you need to stop it, return 1e30 + and stop it afterwards. You may create and start a + EvPrepare watcher for this task. + + + It must return the next time to trigger, based on the passed time value (that + is, the lowest time value larger than or equal to to the second argument). It + will usually be called just before the callback will be triggered, but might + be called at other times, too. + + + + Using reschedule callback + + +]]> + + + + + + + + + diff --git a/reference/ev/reference.xml b/reference/ev/reference.xml new file mode 100644 index 0000000000..ff4a7911b1 --- /dev/null +++ b/reference/ev/reference.xml @@ -0,0 +1,30 @@ + + + + + Ev &Functions; + + &reference.ev.entities.functions; + + + + diff --git a/reference/ev/setup.xml b/reference/ev/setup.xml new file mode 100644 index 0000000000..0ac4ca7788 --- /dev/null +++ b/reference/ev/setup.xml @@ -0,0 +1,57 @@ + + + + + &reftitle.setup; + +
+ &reftitle.required; + + libev library is embedded into this extension. You don't + need to install it separately. + +
+ +
+ &reftitle.install; + + &pecl.moved; + + + &pecl.info; + &url.pecl.package;ev. + +
+ +
+ &reftitle.runtime; + &no.config; +
+ +
+ &reftitle.resources; + &no.resource; +
+ +
+ + diff --git a/reference/ev/versions.xml b/reference/ev/versions.xml new file mode 100644 index 0000000000..7baf396590 --- /dev/null +++ b/reference/ev/versions.xml @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/reference/ev/watcher-callbacks.xml b/reference/ev/watcher-callbacks.xml new file mode 100644 index 0000000000..3aa56ef121 --- /dev/null +++ b/reference/ev/watcher-callbacks.xml @@ -0,0 +1,86 @@ + + + Watcher callbacks + + + All watchers can be active(waiting for events) or inactive(paused). Only + active watchers will have their callbacks invoked. All callbacks will be + called with at least two arguments: watcher - the + watcher, and revents a bitmask of received + events. + + + + Watcher callbacks are passed to the watcher contructors(the classes derived + from EvWatcher - + EvCheck::__construct, + EvChild::__construct etc.). A watcher callback + should match the following prototype: + + + + voidcallback + objectwatcherNULL + intreventsNULL + + + + + + watcher + + + The watcher instance(of a class extending + EvWatcher). + + + + + revents + + + Watcher received events. + + + + + + + + Each watcher type has its associated bit in revents, + so you can use the same callback for multiple watchers. The event mask is + named after the type, i.e. EvChild(or + EvLoop::child) sets EV::CHILD, + EvPrepare(or EvLoop::prepare) + sets Ev::PREPARE, EvPeriodic(or + EvLoop::periodic) sets + Ev::PERIODIC and so on, with the exception of I/O events + (which can set both Ev::READ and + Ev::WRITE bits). + + + + + + diff --git a/reference/ev/watchers.xml b/reference/ev/watchers.xml new file mode 100644 index 0000000000..def1ab488a --- /dev/null +++ b/reference/ev/watchers.xml @@ -0,0 +1,68 @@ + + + Watchers + + + A watcher is an object that gets created to record your interest in some + event. For instance, if you want to wait for STDIN to + become readable, you would create an EvIo watcher for + that: + + +]]> + + + + + All the watcher constructors automatically start the watchers for you. If you + need to create a stopped watcher, use createStopped + method(e.g. EvIo::createStopped) + + + + Note that a watcher will automatically be stopped when the watcher object is + destroyed, so you need to keep the watcher objects returned by the + constructors or factory methods. + + + + Note also that all methods changing some watcher + property(set, priority etc.) + automatically stop and start it again if it is active, which means pending + events get lost. + + + + See also: Watcher callbacks. + + + + + +