<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.threaded.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'threaded.notifyone.php',
    1 => 'Threaded::notifyOne',
    2 => 'Synchronization',
  ),
  'up' => 
  array (
    0 => 'class.threaded.php',
    1 => 'Threaded',
  ),
  'prev' => 
  array (
    0 => 'threaded.notify.php',
    1 => 'Threaded::notify',
  ),
  'next' => 
  array (
    0 => 'threaded.pop.php',
    1 => 'Threaded::pop',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pthreads/threaded/notifyone.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="threaded.notifyone" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Threaded::notifyOne</h1>
  <p class="verinfo">(PECL pthreads &gt;= 3.0.0)</p><p class="refpurpose"><span class="refname">Threaded::notifyOne</span> &mdash; <span class="dc-title">Synchronization</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-threaded.notifyone-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Threaded::notifyOne</strong></span>(): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="simpara">
  Send notification to the referenced object. This unblocks at least one of the
  blocked threads (as opposed to unblocking all of them, as seen with
  <span class="methodname"><a href="threaded.notify.php" class="methodname">Threaded::notify()</a></span>).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-threaded.notifyone-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">Questa funzione non contiene parametri.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-threaded.notifyone-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="simpara">
   Restituisce <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> in caso di successo, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-threaded.notifyone-examples">
  <h3 class="title">Esempi</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 Notifications and Waiting</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">My </span><span style="color: #007700">extends </span><span style="color: #0000BB">Thread </span><span style="color: #007700">{<br />    public function </span><span style="color: #0000BB">run</span><span style="color: #007700">() {<br />        </span><span style="color: #FF8000">/** cause this thread to wait **/<br />        </span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">synchronized</span><span style="color: #007700">(function(</span><span style="color: #0000BB">$thread</span><span style="color: #007700">){<br />            if (!</span><span style="color: #0000BB">$thread</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">done</span><span style="color: #007700">)<br />                </span><span style="color: #0000BB">$thread</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">wait</span><span style="color: #007700">();<br />        }, </span><span style="color: #0000BB">$this</span><span style="color: #007700">);<br />    }<br />}<br /></span><span style="color: #0000BB">$my </span><span style="color: #007700">= new </span><span style="color: #0000BB">My</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$my</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">start</span><span style="color: #007700">();<br /></span><span style="color: #FF8000">/** send notification to the waiting thread **/<br /></span><span style="color: #0000BB">$my</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">synchronized</span><span style="color: #007700">(function(</span><span style="color: #0000BB">$thread</span><span style="color: #007700">){<br />    </span><span style="color: #0000BB">$thread</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">done </span><span style="color: #007700">= </span><span style="color: #0000BB">true</span><span style="color: #007700">;<br />    </span><span style="color: #0000BB">$thread</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">notifyOne</span><span style="color: #007700">();<br />}, </span><span style="color: #0000BB">$my</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$my</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">join</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Il precedente esempio visualizzerà:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">bool(true)</pre>
</div>
   </div>
  </div>
 </div>

</div><?php manual_footer($setup); ?>