svn: /phpdoc/en/trunk/reference/win32service/functions/ win32-start-service-ctrl-dispatcher.xml

From: Date: Mon, 08 Nov 2010 16:57:13 +0000
Subject: svn: /phpdoc/en/trunk/reference/win32service/functions/ win32-start-service-ctrl-dispatcher.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-7392@lists.php.net to get a copy of this message
rquadling Mon, 08 Nov 2010 16:57:13 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=305205 Log: Don't automatically assume a service is ready to run. Allow a script to report back WIN32_SERVICE_START_PENDING before WIN32_SERVICE_RUNNING. Changed paths: U phpdoc/en/trunk/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml Modified: phpdoc/en/trunk/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml =================================================================== --- phpdoc/en/trunk/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml 2010-11-08 16:50:05 UTC (rev 305204) +++ phpdoc/en/trunk/reference/win32service/functions/win32-start-service-ctrl-dispatcher.xml 2010-11-08 16:57:13 UTC (rev 305205) @@ -21,11 +21,16 @@ 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. + Once started, the service process should do 2 things. The first is to tell + the Service Control Manager that the service is running. This is achieved + by calling <function>win32_set_service_status</function> with the + <constant>WIN32_SERVICE_RUNNING<constant> constant. If you need to perform + some lengthy process before the service is actually running, then you can + use the <constant>WIN32_SERVICE_START_PENDING</constant> constant. The + second is to 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> @@ -68,6 +73,12 @@ die("I'm probably not running under the service control manager"); } +win32_set_service_status(WIN32_SERVICE_START_PENDING); + +// Some lengthy process to get this service up and running. + +win32_set_service_status(WIN32_SERVICE_RUNNING); + 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 @@ -83,6 +94,7 @@ &reftitle.seealso; <para> <simplelist> + <member><function>win32_set_service_status</function></member> <member><function>win32_get_last_control_message</function></member> <member><link linkend="win32service.constants.errors">Win32 Error Codes</link></member> </simplelist>

« previous php.doc.cvs (#7392) next »