<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The EvCheck class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ev.verify.html">Ev::verify</a></div> <div class="next" style="text-align: right; float: right;"><a href="evcheck.construct.html">EvCheck::__construct</a></div> <div class="up"><a href="book.ev.html">Ev</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.evcheck" class="reference"> <h1 class="title">The EvCheck class</h1> <div class="partintro"><p class="verinfo">(PECL ev >= 0.2.0)</p> <div class="section" id="evcheck.intro"> <h2 class="title">Introduction</h2> <p class="para"> <a href="class.evprepare.html" class="classname">EvPrepare</a> and <strong class="classname">EvCheck</strong> watchers are usually used in pairs. <a href="class.evprepare.html" class="classname">EvPrepare</a> watchers get invoked before the process blocks, <strong class="classname">EvCheck</strong> afterwards. </p> <p class="para"> It is not allowed to call <span class="methodname"><a href="evloop.run.html" class="methodname">EvLoop::run()</a></span> or similar methods or functions that enter the current event loop from either <a href="class.evprepare.html" class="classname">EvPrepare</a> or <strong class="classname">EvCheck</strong> watchers. Other loops than the current one are fine, however. The rationale behind this is that one don't need to check for recursion in those watchers, i.e. the sequence will always be: <a href="class.evprepare.html" class="classname">EvPrepare</a> -> blocking -> <strong class="classname">EvCheck</strong> , so having a watcher of each kind they will always be called in pairs bracketing the blocking call. </p> <p class="para"> The main purpose is to integrate other event mechanisms into <em class="emphasis">libev</em> and their use is somewhat advanced. They could be used, for example, to track variable changes, implement custom watchers, integrate net-snmp or a coroutine library and lots more. They are also occasionally useful to cache some data and want to flush it before blocking. </p> <p class="para"> It is recommended to give <strong class="classname">EvCheck</strong> watchers highest( <strong><code>Ev::MAXPRI</code></strong> ) priority, to ensure that they are being run before any other watchers after the poll (this doesn’t matter for <a href="class.evprepare.html" class="classname">EvPrepare</a> watchers). </p> <p class="para"> Also, <strong class="classname">EvCheck</strong> watchers should not activate/feed events. While <em class="emphasis">libev</em> fully supports this, they might get executed before other <strong class="classname">EvCheck</strong> watchers did their job. </p> </div> <div class="section" id="evcheck.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"> </div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">EvCheck</strong> </span> <span class="ooclass"> <span class="modifier">extends</span> <a href="class.evwatcher.html" class="classname">EvWatcher</a> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Inherited properties */</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evwatcher.html#evwatcher.props.is-active">$<var class="varname">is_active</var></a></var> ;</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evwatcher.html#evwatcher.props.data">$<var class="varname">data</var></a></var> ;</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evwatcher.html#evwatcher.props.is-pending">$<var class="varname">is_pending</var></a></var> ;</div> <div class="fieldsynopsis"> <span class="modifier">public</span> <var class="varname"><a href="class.evwatcher.html#evwatcher.props.priority">$<var class="varname">priority</var></a></var> ;</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><a href="evcheck.construct.html" class="methodname">__construct</a></span> ( <span class="methodparam"> <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code> </span> [, <span class="methodparam"> <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$data</code> </span> [, <span class="methodparam"> <span class="type">int</span> <code class="parameter">$priority</code> </span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">object</span> <span class="methodname"><a href="evcheck.createstopped.html" class="methodname">createStopped</a></span> ( <span class="methodparam"> <span class="type">string</span> <code class="parameter">$callback</code> </span> [, <span class="methodparam"> <span class="type">string</span> <code class="parameter">$data</code> </span> [, <span class="methodparam"> <span class="type">string</span> <code class="parameter">$priority</code> </span> ]] )</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Inherited methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="evwatcher.clear.html" class="methodname">EvWatcher::clear</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">abstract</span> <span class="modifier">public</span> <span class="methodname"><a href="evwatcher.construct.html" class="methodname">EvWatcher::__construct</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.feed.html" class="methodname">EvWatcher::feed</a></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$revents</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">EvLoop</span> <span class="methodname"><a href="evwatcher.getloop.html" class="methodname">EvWatcher::getLoop</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.invoke.html" class="methodname">EvWatcher::invoke</a></span> ( <span class="methodparam"> <span class="type">int</span> <code class="parameter">$revents</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="evwatcher.keepalive.html" class="methodname">EvWatcher::keepalive</a></span> ([ <span class="methodparam"> <span class="type">bool</span> <code class="parameter">$value</code> </span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.setcallback.html" class="methodname">EvWatcher::setCallback</a></span> ( <span class="methodparam"> <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code> </span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.start.html" class="methodname">EvWatcher::start</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="evwatcher.stop.html" class="methodname">EvWatcher::stop</a></span> ( <span class="methodparam">void</span> )</div> }</div> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="evcheck.construct.html">EvCheck::__construct</a> — Constructs the EvCheck watcher object</li><li><a href="evcheck.createstopped.html">EvCheck::createStopped</a> — Create instance of a stopped EvCheck watcher</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ev.verify.html">Ev::verify</a></div> <div class="next" style="text-align: right; float: right;"><a href="evcheck.construct.html">EvCheck::__construct</a></div> <div class="up"><a href="book.ev.html">Ev</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>