<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry xml:id="parallel-events.setblocking" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>parallel\Events::setBlocking</refname>
  <refpurpose>Behaviour</refpurpose>
 </refnamediv>

 <refsect1 role="description" audience="behaviour">
  &reftitle.description;
  <para>
   By default when events are polled for, blocking will occur (at the PHP level) until the first event can be returned: Setting blocking mode to &false; will cause
   poll to return control if the first target polled is not ready.
  </para>
  <para>
   This differs from setting a timeout of 0 with <methodname>parallel\Events::setTimeout</methodname>, since a timeout of 0, while allowed, will cause an exception 
   to be raised, which may be extremely slow or wasteful if what is really desired is non-blocking behaviour.
  </para>
  <para>
   A non-blocking loop effects the return value of <methodname>parallel\Events::poll</methodname>, such that it may be &null; before all events have been processed.
  </para>
  <methodsynopsis>
   <modifier>public</modifier> <type>void</type><methodname>parallel\Events::setBlocking</methodname>
   <methodparam><type>bool</type><parameter>blocking</parameter></methodparam>
  </methodsynopsis>
  <para>
    Shall set blocking mode
  </para>
 </refsect1>

 <refsect1 role="exceptions">
  <title>Exceptions</title>
  <warning>
   <para>
    Shall throw <type>parallel\Events\Error</type> if loop has timeout set.
   </para>
  </warning>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
