php-doc-en/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml
Daniel Egeberg 96c9d88bad Converted to utf-8
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297028 c90b9560-bf6c-de11-be94-00142212c4b1
2010-03-28 22:10:10 +00:00

113 lines
3.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- Generated by xml_proto.php v2.3. Found in /scripts directory of phpdoc. -->
<refentry xml:id="function.win32-start-service-ctrl-dispatcher" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>win32_start_service_ctrl_dispatcher</refname>
<refpurpose>Registers the script with the SCM, so that it can act as the service with the given name</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>win32_start_service_ctrl_dispatcher</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis>
<para>
When launched via the Service Control Manager, a service process is
required to "check-in" with it to establish service monitoring and
communication facilities. This function performs the check-in by spawning
a thread to handle the lower-level communication with the service control
manager.
</para>
<para>
Once started, the service process should continue to check-in with the
service control manager so that it can determine if it should terminate.
This is achieved by periodically calling
<function>win32_get_last_control_message</function> and handling the return
code appropriately.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>name</parameter></term>
<listitem>
<para>
The short-name of the service, as registered by
<function>win32_create_service</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; on success, otherwise &false; or a win32 error code.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <function>win32_start_service_ctrl_dispatcher</function> example</title>
<para>
Check if the service is runnig under the SCM.
</para>
<programlisting role="php">
<![CDATA[
<?php
if (!win32_start_service_ctrl_dispatcher('dummyphp')) {
die("I'm probably not running under the service control manager");
}
while (WIN32_SERVICE_CONTROL_STOP != win32_get_last_control_message()) {
# do some work here, trying not to take more than around 30 seconds
# before coming back into the loop again
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>win32_get_last_control_message</function></member>
</simplelist>
</para>
</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
-->