Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 2790

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!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>Prepare an event</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.event-new.html">event_new</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.pcntl.html">PCNTL</a></div>
 <div class="up"><a href="ref.libevent.html">Libevent Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.event-set" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">event_set</h1>
  <p class="verinfo">(PECL libevent &gt;= 0.0.1)</p><p class="refpurpose"><span class="refname">event_set</span> &mdash; <span class="dc-title">Prepare an event</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.event-set-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><a href="event.set.html" class="methodname">event_set</a></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$event</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">$fd</code></span>
   , <span class="methodparam"><span class="type">int</span> <code class="parameter">$events</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">$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">$arg</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Prepares the event to be used in  <span class="function"><a href="event.add.html" class="function">event_add()</a></span>. The event
   is prepared to call the function specified by the <em><code class="parameter">callback</code></em> 
   on the events specified in parameter <em><code class="parameter">events</code></em>, which
   is a set of the following flags: <strong><code>EV_TIMEOUT</code></strong>, 
   <strong><code>EV_SIGNAL</code></strong>, <strong><code>EV_READ</code></strong>, 
   <strong><code>EV_WRITE</code></strong> and <strong><code>EV_PERSIST</code></strong>.
  </p> 
  <p class="para">
   If <strong><code>EV_SIGNAL</code></strong> bit is set in parameter <em><code class="parameter">events</code></em>,
   the <em><code class="parameter">fd</code></em> is interpreted as signal number.
  </p>
  <p class="para">
   After initializing the event, use  <span class="function"><a href="function.event-base-set.html" class="function">event_base_set()</a></span> to
   associate the event with its event base.
  </p>
  <p class="para">
   In case of matching event, these three arguments are passed to the
   <em><code class="parameter">callback</code></em> function: 
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">fd</code></em></span>
     <dd>

      <p class="para">
       Signal number or resource indicating the stream.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">events</code></em></span>
     <dd>

      <p class="para">
       A flag indicating the event. Consists of the following flags:
       <strong><code>EV_TIMEOUT</code></strong>, <strong><code>EV_SIGNAL</code></strong>, 
       <strong><code>EV_READ</code></strong>, <strong><code>EV_WRITE</code></strong>
       and <strong><code>EV_PERSIST</code></strong>.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">arg</code></em></span>
     <dd>

      <p class="para">
       Optional parameter, previously passed to  <span class="function"><a href="event.set.html" class="function">event_set()</a></span>
       as <em><code class="parameter">arg</code></em>.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.event-set-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">event</code></em></span>
     <dd>

      <p class="para">
       Valid event resource.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">fd</code></em></span>
     <dd>

      <p class="para">
       Valid PHP stream resource. The stream must be castable to file
       descriptor, so you most likely won&#039;t be able to use any of filtered
       streams.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">events</code></em></span>
     <dd>

      <p class="para">
       A set of flags indicating the desired event, can be
       <strong><code>EV_READ</code></strong> and/or <strong><code>EV_WRITE</code></strong>.
       The additional flag <strong><code>EV_PERSIST</code></strong> makes the event
       to persist until  <span class="function"><a href="event.del.html" class="function">event_del()</a></span> is called, otherwise
       the callback is invoked only once. 
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">callback</code></em></span>
     <dd>

      <p class="para">
       Callback function to be called when the matching event occurs.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">arg</code></em></span>
     <dd>

      <p class="para">
       Optional callback parameter.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.event-set-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
    <span class="function"><a href="event.set.html" class="function">event_set()</a></span> returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.event-set-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>0.0.4</td>
      <td>
       <strong><code>EV_SIGNAL</code></strong> support was added.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.event-new.html">event_new</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.pcntl.html">PCNTL</a></div>
 <div class="up"><a href="ref.libevent.html">Libevent Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>