<!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>Process COM messages, sleeping for up to timeoutms milliseconds</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.com-load.html">com_load</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.com-print-typeinfo.html">com_print_typeinfo</a></div> <div class="up"><a href="ref.com.html">COM Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.com-message-pump" class="refentry"> <div class="refnamediv"> <h1 class="refname">com_message_pump</h1> <p class="verinfo">(PHP 4 >= 4.2.0, PHP 5)</p><p class="refpurpose"><span class="refname">com_message_pump</span> — <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">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>com_message_pump</strong></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeoutms</code><span class="initializer"> = 0</span></span> ] )</div> <p class="para rdfs-comment"> This function will sleep for up to <em><code class="parameter">timeoutms</code></em> 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.html" 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">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">timeoutms</code></em></span> <dd> <p class="para"> The timeout, in milliseconds. </p> <p class="para"> If you do not specify a value for <em><code class="parameter">timeoutms</code></em>, 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>FALSE</code></strong> immediately without sleeping. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.com-message-pump-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> If a message or messages arrives before the timeout, they will be dispatched, and the function will return <strong><code>TRUE</code></strong>. If the timeout occurs and no messages were processed, the return value will be <strong><code>FALSE</code></strong>. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.com-load.html">com_load</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.com-print-typeinfo.html">com_print_typeinfo</a></div> <div class="up"><a href="ref.com.html">COM Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>