<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.event.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'class.event.php',
    1 => 'Event',
    2 => 'The Event class',
  ),
  'up' => 
  array (
    0 => 'book.event.php',
    1 => 'Event',
  ),
  'prev' => 
  array (
    0 => 'event.constructing.signal.events.php',
    1 => 'Constructing signal events',
  ),
  'next' => 
  array (
    0 => 'event.add.php',
    1 => 'Event::add',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/event/event.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.event.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.event" class="reference">
 <h1 class="title">The Event class</h1>
 
 <div class="partintro"><p class="verinfo">(PECL event &gt;= 1.2.6-beta)</p>

  <div class="section" id="event.intro">
   <h2 class="title">Вступ</h2>
   <p class="para">
    <span class="classname"><strong class="classname">Event</strong></span>
    class represents and event firing on a file descriptor being ready to read
    from or write to; a file descriptor becoming ready to read from or write
    to(edge-triggered I/O only); a timeout expiring; a signal occurring; a
    user-triggered event.
   </p>
   <p class="para">
    Every event is associated with
    <span class="classname"><a href="class.eventbase.php" class="classname">EventBase</a></span>.
    However, event will never fire until it is
    <em>added</em>
    (via
    <span class="methodname"><a href="event.add.php" class="methodname">Event::add()</a></span>
    ). An added event remains in
    <em>pending</em>
    state until the registered event occurs, thus turning it to
    <em>active</em>
    state. To handle events user may register a callback which is called when
    event becomes active. If event is configured
    <em>persistent</em>,
    it remains pending. If it is not persistent, it stops being pending when
    it&#039;s callback runs.
    <span class="methodname"><a href="event.del.php" class="methodname">Event::del()</a></span>
    method
    <em>deletes</em>
    event, thus making it non-pending. By means of
    <span class="methodname"><a href="event.add.php" class="methodname">Event::add()</a></span>
    method it could be added again.
   </p>
  </div>

  <div class="section" id="event.synopsis">
   <h2 class="title">Короткий огляд класу</h2>


   <div class="classsynopsis">
    <span class="ooclass">
     <strong class="classname"></strong>
    </span>

    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">final</span>
      <span class="modifier">class</span> <strong class="classname">Event</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Константи */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.event.php#event.constants.et"><var class="varname">ET</var></a></var><span class="initializer"> = 32</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.event.php#event.constants.persist"><var class="varname">PERSIST</var></a></var><span class="initializer"> = 16</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.event.php#event.constants.read"><var class="varname">READ</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.event.php#event.constants.write"><var class="varname">WRITE</var></a></var><span class="initializer"> = 4</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.event.php#event.constants.signal"><var class="varname">SIGNAL</var></a></var><span class="initializer"> = 8</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>
      <var class="fieldsynopsis_varname"><a href="class.event.php#event.constants.timeout"><var class="varname">TIMEOUT</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Властивості */</div>
    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="modifier">readonly</span>
     <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
      <var class="varname"><a href="class.event.php#event.props.pending">$<var class="varname">pending</var></a></var>;</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Методи */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="methodname"><a href="event.add.php" class="methodname">add</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.float.php" class="type float">float</a></span> <code class="parameter">$timeout</code>
   <span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="event.construct.php" class="methodname">__construct</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="class.eventbase.php" class="type EventBase">EventBase</a></span> <code class="parameter">$base</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$fd</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$what</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$cb</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$arg</code>
    <span class="initializer"> = NULL</span>
   </span><br>)</div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="event.del.php" class="methodname">del</a></span>(): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="event.free.php" class="methodname">free</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="methodname"><a href="event.getsupportedmethods.php" class="methodname">getSupportedMethods</a></span>(): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="event.pending.php" class="methodname">pending</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="event.set.php" class="methodname">set</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="class.eventbase.php" class="type EventBase">EventBase</a></span> <code class="parameter">$base</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$fd</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$what</code>
   <span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$cb</code>
   <span class="initializer"> = ?</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$arg</code>
   <span class="initializer"> = ?</span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="event.setpriority.php" class="methodname">setPriority</a></span>(<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$priority</code>
   </span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="methodname"><a href="event.settimer.php" class="methodname">setTimer</a></span>(<span class="methodparam">
    
    <span class="type"><a href="class.eventbase.php" class="type EventBase">EventBase</a></span> <code class="parameter">$base</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$cb</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$arg</code>
   <span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="methodname"><a href="event.signal.php" class="methodname">signal</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="class.eventbase.php" class="type EventBase">EventBase</a></span> <code class="parameter">$base</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$signum</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$cb</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$arg</code>
   <span class="initializer"> = ?</span></span><br>): <span class="type"><a href="class.event.php" class="type Event">Event</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="methodname"><a href="event.timer.php" class="methodname">timer</a></span>(<span class="methodparam">
    
    <span class="type"><a href="class.eventbase.php" class="type EventBase">EventBase</a></span> <code class="parameter">$base</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span> <code class="parameter">$cb</code>
   </span>, <span class="methodparam">
    
    <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$arg</code>
   <span class="initializer"> = ?</span></span>): <span class="type"><a href="class.event.php" class="type Event">Event</a></span></div>

   }</div>

  </div>

  <div class="section" id="event.props">
   <h2 class="title">Властивості</h2>
   <dl>
    
     <dt id="event.props.pending">
      <var class="varname">pending</var>
     </dt>
     <dd>
      <p class="para">
       Whether event is pending. See
       <a href="event.persistence.php" class="link">About event persistence</a>.
      </p>
     </dd>
    
   </dl>
  </div>


  <div class="section" id="event.constants">
   <h2 class="title">Попередньо визначені константи</h2>
   <dl>
    
     <dt id="event.constants.et">
      <strong><code><a href="class.event.php#event.constants.et">Event::ET</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       Indicates that the event should be edge-triggered, if the underlying
       event base backend supports edge-triggered events. This affects the
       semantics of
       <strong><code><a href="class.event.php#event.constants.read">Event::READ</a></code></strong>
       and
       <strong><code><a href="class.event.php#event.constants.write">Event::WRITE</a></code></strong>.
      </p>
     </dd>
    
    
     <dt id="event.constants.persist">
      <strong><code><a href="class.event.php#event.constants.persist">Event::PERSIST</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       Indicates that the event is persistent. See
       <a href="event.persistence.php" class="link">About event persistence</a>.
      </p>
     </dd>
    
    
     <dt id="event.constants.read">
      <strong><code><a href="class.event.php#event.constants.read">Event::READ</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       This flag indicates an event that becomes active when the provided file
       descriptor(usually a stream resource, or socket) is ready for reading.
      </p>
     </dd>
    
    
     <dt id="event.constants.write">
      <strong><code><a href="class.event.php#event.constants.write">Event::WRITE</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       This flag indicates an event that becomes active when the provided file
       descriptor(usually a stream resource, or socket) is ready for reading.
      </p>
     </dd>
    
    
     <dt id="event.constants.signal">
      <strong><code><a href="class.event.php#event.constants.signal">Event::SIGNAL</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       Used to implement signal detection. See &quot;Constructing signal events&quot;
       below.
      </p>
     </dd>
    
    
     <dt id="event.constants.timeout">
      <strong><code><a href="class.event.php#event.constants.timeout">Event::TIMEOUT</a></code></strong>
     </dt>
     <dd>
      <p class="para">
       This flag indicates an event that becomes active after a timeout
       elapses.
      </p>
      <p class="para">
       The
       <strong><code><a href="class.event.php#event.constants.timeout">Event::TIMEOUT</a></code></strong>
       flag is ignored when constructing an event: one can either set a
       timeout when event is
       <em>added</em>,
       or not. It is set in the
       <code class="literal">$what</code>
       argument to the callback function when a timeout has occurred.
      </p>
     </dd>
    
   </dl>
  </div>

 </div>

 











































































<h2>Зміст</h2><ul class="chunklist chunklist_reference"><li><a href="event.add.php">Event::add</a> — Makes event pending</li><li><a href="event.addsignal.php">Event::addSignal</a> — Псевдонім Event::add</li><li><a href="event.addtimer.php">Event::addTimer</a> — Псевдонім Event::add</li><li><a href="event.construct.php">Event::__construct</a> — Constructs Event object</li><li><a href="event.del.php">Event::del</a> — Makes event non-pending</li><li><a href="event.delsignal.php">Event::delSignal</a> — Псевдонім Event::del</li><li><a href="event.deltimer.php">Event::delTimer</a> — Псевдонім Event::del</li><li><a href="event.free.php">Event::free</a> — Make event non-pending and free resources allocated for this
  event</li><li><a href="event.getsupportedmethods.php">Event::getSupportedMethods</a> — Returns array with of the names of the methods supported in this version of Libevent</li><li><a href="event.pending.php">Event::pending</a> — Detects whether event is pending or scheduled</li><li><a href="event.set.php">Event::set</a> — Re-configures event</li><li><a href="event.setpriority.php">Event::setPriority</a> — Set event priority</li><li><a href="event.settimer.php">Event::setTimer</a> — Re-configures timer event</li><li><a href="event.signal.php">Event::signal</a> — Constructs signal event object</li><li><a href="event.timer.php">Event::timer</a> — Constructs timer event object</li></ul>
</div>
<?php manual_footer($setup); ?>