httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Costello <timcoste...@ozemail.com.au>
Subject RE: Platform Specific MPM Design Questions
Date Thu, 01 Jan 1970 00:00:00 GMT
On Wednesday, 24 May 2000, William A. Rowe, Jr. wrote:
>   http_main.c     main() calls
>     mod_mpm_winnt   ap_hook_args() calls
>       kernel32        StartService() calls
>         mod_mpm_hookservice() which will set up a vector to return back into
>                               the return vector of the ap_hook_args() call so
>                               we resume execution exactly where we left off.

Aaaaah. I'm starting to see what you're getting at. You want http_main to
contain the real main, and to do away with main_win32.c. Then, have the mpm 
do stuff, call the scm, then return to the end of the mpm, so main's always 
at the top of the call stack (instead of service_main). Right?

> 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;
}

I figure the phony ServiceMain is okay because it's unlikely that multiple 
(different) services will share apache's executable.

I know this doesn't touch your problem of getting at the command-line - but 
it's another option that retains the flow of execution (and the values of 
main's local variables). It also might spark something better in someone 
else's head. 

Tim

This message was sent through MyMail http://www.mymail.com.au



Mime
View raw message