httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@lnd.com>
Subject RE: Platform Specific MPM Design Questions
Date Thu, 25 May 2000 04:26:12 GMT
> From: Tim Costello [mailto:timcostello@ozemail.com.au]
> Sent: Wednesday, May 24, 2000 1:57 PM
> 
> > Recursive main() I hope won't happen.  Not if I can get 
> return vectors to 
> > resume execution at the code step after launching the 
> service.  Any good
> > examples would be appreciated.  [This does -not- have to be 
> xplatform :-]
> 
> I have another suggestion - what about the following for the mpm's 
> pre-config hook:
> 
> void winnt_pre_config()
> {
>     if (running_as_service) {
>         service_sync_event = CreateEvent(not_signaled);
>         CreateThread(dispatcher_thread_proc);
>     }
>     ...
>         /* all other pre-config processing */
>     ...
>     if (running_as_service) {
>         WaitForSingleObject(service_sync_event, INFINITE);
>         SetServiceStatus(SERVICE_START_PENDING);
>     }
> }
> 
> int dispatcher_thread_proc()
> {
>     StartServiceCtrlDispatcher(service_main);
>     /* 
>      * blocks in above function "forever" - the thread 
> becomes becomes the 
>      * service control dispatcher
>      */
> }
> 
> void service_main()
> {
>     /* save the service name somewhere if we need it */
>     SetEvent(service_sync_event);
>     return;
> }

Ok... the remaining problem is the return; from service_main,
and it looks like we need to block there as well for the
service to completely terminate.  If we block in service_main,
we can idle the thread while Apache lives.

I'll try your idea first, and then return to my original
concept only if this fails horribly.

Bill

Mime
View raw message