<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.com.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.com-message-pump.php',
    1 => 'com_message_pump',
    2 => 'Process COM messages, sleeping for up to timeoutms milliseconds',
  ),
  'up' => 
  array (
    0 => 'ref.com.php',
    1 => 'COM 函数',
  ),
  'prev' => 
  array (
    0 => 'function.com-load-typelib.php',
    1 => 'com_load_typelib',
  ),
  'next' => 
  array (
    0 => 'function.com-print-typeinfo.php',
    1 => 'com_print_typeinfo',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/com/functions/com-message-pump.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.com-message-pump" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">com_message_pump</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">com_message_pump</span> &mdash; <span class="dc-title">Process COM messages, sleeping for up to timeoutms milliseconds</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.com-message-pump-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>com_message_pump</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$timeout_milliseconds</code><span class="initializer"> = 0</span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   This function will sleep for up to <code class="parameter">timeout_milliseconds</code>
   milliseconds, or until a message arrives in the queue.
  </p>
  <p class="para">
   The purpose of this function is to route COM calls between apartments and
   handle various synchronization issues.  This allows your script to wait
   efficiently for events to be triggered, while still handling other events
   or running other code in the background.  You should use it in a loop, as
   demonstrated by the example in the <span class="function"><a href="function.com-event-sink.php" class="function">com_event_sink()</a></span>
   function, until you are finished using event bound COM objects.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.com-message-pump-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">timeout_milliseconds</code></dt>
     <dd>
      <p class="para">
       The timeout, in milliseconds.
      </p>
      <p class="para">
       If you do not specify a value for <code class="parameter">timeout_milliseconds</code>,
       then 0 will be assumed.  A 0 value means that no waiting will be
       performed; if there are messages pending they will be dispatched as
       before; if there are no messages pending, the function will return
       <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> immediately without sleeping.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.com-message-pump-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   If a message or messages arrives before the timeout, they will be
   dispatched, and the function will return <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>. If the timeout occurs and
   no messages were processed, the return value will be <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>

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