<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'class.event.php',
    1 => 'Event',
    2 => 'La classe Event',
  ),
  'up' => 
  array (
    0 => 'book.event.php',
    1 => 'Event',
  ),
  'prev' => 
  array (
    0 => 'event.constructing.signal.events.php',
    1 => 'Construction d\'un &eacute;v&eacute;nement de type signal',
  ),
  'next' => 
  array (
    0 => 'event.add.php',
    1 => 'Event::add',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    '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">La classe Event</h1>
 
 <div class="partintro"><p class="verinfo">(PECL event &gt;= 1.2.6-beta)</p>

  <div class="section" id="event.intro">
   <h2 class="title">Introduction</h2>
   <p class="para">
    La classe <span class="classname"><strong class="classname">Event</strong></span> représente et lance un événement
    sur un descripteur de fichier devenu prêt pour une lecture ou une écriture ;
    un descripteur de fichier devient prêt pour une lecture ou une écriture
    (I/O uniquement) ; un délai d&#039;attente expiré ; un signal survenant ;
    un événement lancé par l&#039;utilisateur.
   </p>
   <p class="para">
    Chaque événement est associé avec un <span class="classname"><a href="class.eventbase.php" class="classname">EventBase</a></span>.
    Cependant, l&#039;événement ne sera jamais lancé tant qu&#039;il n&#039;a pas été
    <em>ajouté</em> (via la méthode <span class="methodname"><a href="event.add.php" class="methodname">Event::add()</a></span>).
    Un événement ajouté reste dans un statut d&#039;<em>attente</em>
    tant que l&#039;événement enregistré ne survient pas, le passant ainsi en
    statut <em>actif</em>. Pour gérer les événements, l&#039;utilisateur
    doit enregistrer une fonction de rappel qui sera appelée lorsque l&#039;événement
    devient actif. Si l&#039;événement est configuré comme <em>persistent</em>,
    il restera en attente. S&#039;il n&#039;est pas persistent, il ne sera plus en attente
    lorsque sa fonction de rappel sera exécutée. La méthode <span class="methodname"><a href="event.del.php" class="methodname">Event::del()</a></span>
    <em>supprime</em> l&#039;événement, il n&#039;est alors plus en attente.
    En appelant la méthode <span class="methodname"><a href="event.add.php" class="methodname">Event::add()</a></span>, il sera ajouté
    de nouveau.
   </p>
  </div>

  <div class="section" id="event.synopsis">
   <h2 class="title">Synopsis de la classe</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">/* Constantes */</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">/* Propriétés */</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">/* Méthodes */</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">Propriétés</h2>
   <dl>
    
     <dt id="event.props.pending">
      <var class="varname">pending</var>
     </dt>
     <dd>
      <p class="para">
       Si l&#039;événement est en attente. Voir la section :
       <a href="event.persistence.php" class="link">À propos de la persistence des événements</a>.
      </p>
     </dd>
    
   </dl>
  </div>


  <div class="section" id="event.constants">
   <h2 class="title">Constantes pré-définies</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">
       Indique que l&#039;événement doit être lancé, si la base d&#039;événement
       sous-jacente supporte ce type d&#039;événement. Ceci affecte la sémantique
       de <strong><code><a href="class.event.php#event.constants.read">Event::READ</a></code></strong> et de <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">
       Indique que l&#039;événement est persistent. Voir la section :
       <a href="event.persistence.php" class="link">À propos de la persistence des événements</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">
       Ce drapeau indique qu&#039;un événement devient actif lorsque le descripteur
       de fichier fourni (habituellement, une ressource de flux ou un socket)
       est prêt pour une lecture.
      </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">
       Ce drapeau indique qu&#039;un événement devient actif lorsque le descripteur
       de fichier fourni (habituellement, une ressource de flux ou un socket)
       est prêt pour une écriture.
      </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">
       Utilisé pour implémenter une détection de signal. Voir la section ci-dessous
       sur la construction d&#039;un événement de type signal.
      </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">
       Ce drapeau indique qu&#039;un événement devient actif après l&#039;expiration
       de ce délai d&#039;attente maximal.
      </p>
      <p class="para">
       Le drapeau <strong><code><a href="class.event.php#event.constants.timeout">Event::TIMEOUT</a></code></strong> est ignoré lors de la
       construction d&#039;un événement : il peut être indiqué ou non lors de
       <em>l&#039;ajout</em> de l&#039;événement. Il doit être défini dans
       l&#039;argument <code class="literal">$what</code> de la fonction de rappel
       lorsqu&#039;un délai d&#039;attente maximal est survenu.
      </p>
     </dd>
    
   </dl>
  </div>

 </div>

 












































































































<h2>Sommaire</h2><ul class="chunklist chunklist_reference"><li><a href="event.add.php">Event::add</a> — Bascule un &eacute;v&egrave;nement en attente</li><li><a href="event.addsignal.php">Event::addSignal</a> — Alias de Event::add</li><li><a href="event.addtimer.php">Event::addTimer</a> — Alias de Event::add</li><li><a href="event.construct.php">Event::__construct</a> — Construit un objet Event</li><li><a href="event.del.php">Event::del</a> — Supprime un &eacute;v&eacute;nement de la liste des &eacute;v&eacute;nements surveill&eacute;s</li><li><a href="event.delsignal.php">Event::delSignal</a> — Alias de Event::del</li><li><a href="event.deltimer.php">Event::delTimer</a> — Alias de Event::del</li><li><a href="event.free.php">Event::free</a> — Supprime un &eacute;v&eacute;nement de la liste des &eacute;v&eacute;nements surveill&eacute;s
   et lib&egrave;re les ressources associ&eacute;es</li><li><a href="event.getsupportedmethods.php">Event::getSupportedMethods</a> — Retourne un tableau contenant les noms des m&eacute;thodes support&eacute;es
   par cette version de Libevent</li><li><a href="event.pending.php">Event::pending</a> — D&eacute;tecte si l'&eacute;v&eacute;nement est en attente ou programm&eacute;</li><li><a href="event.set.php">Event::set</a> — Re-configure l'&eacute;v&eacute;nement</li><li><a href="event.setpriority.php">Event::setPriority</a> — D&eacute;finit la priorit&eacute; de l'&eacute;v&eacute;nement</li><li><a href="event.settimer.php">Event::setTimer</a> — Re-configure un &eacute;v&eacute;nement timer</li><li><a href="event.signal.php">Event::signal</a> — Construit un objet d'&eacute;v&eacute;nement signal</li><li><a href="event.timer.php">Event::timer</a> — Construit un objet d'&eacute;v&eacute;nement timer</li></ul>
</div>
<?php manual_footer($setup); ?>