apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mladen Turk" <mt...@mappingsoft.com>
Subject Re: [PATCH] WIN32 Optimistic apr_proc_kill
Date Sat, 16 Feb 2002 18:26:50 GMT

----- Original Message -----
From: "William A. Rowe, Jr." <wrowe@covalent.net>
To: "Mladen Turk" <mturk@mappingsoft.com>; "Bill Tutt" <rassilon@lyra.org>;
Sent: Saturday, February 16, 2002 6:47 PM
Subject: Re: [PATCH] WIN32 Optimistic apr_proc_kill

> From: "Mladen Turk" <mturk@mappingsoft.com>
> Sent: Saturday, February 16, 2002 7:09 AM
> >
> > From: "Bill Tutt" <rassilon@lyra.org>
> > Sent: Saturday, February 16, 2002 12:57 AM
> >
> > > Not quite. Yes we're calling kill, but you also don't want an A/V
> > > to pop up and prevent the process from exiting.  The reason that this
> > > possible is because ExitProcess causes DLL entry points to get called
> > > with a notification that the process is exiting.
> The upshot?  This requires some well thought out action before we begin
> code into other processes.  But I agree with the concensus here, we need
to support
> both apr and non-apr app execution, clean up both, and it would be
terrific to be
> able to drop the 16 bit apps.  Perhaps as a build-time option, and create
a new
> symbol APR_HAS_LEGACY_CREATE_CHILD or something for those that -need-
this.  Keep
> in mind that pretty soon, the 32 bit apps will be legacy within the 32-bit
WOW in
> 64-bit Windows :)

I'm sorry if my English Leeds to some misunderstanding. My primary intention
with that patch was to try to kill the entire process tree. I suppose that
everyone sees the benefit of that.
Personally, I hate the "what if" questions, because those questions are
probably less then 1% of problems. For me the displaying of some messagebox
is less irrelevant then 100 processes left hanging from some perl script.
I'm probably lousy perl programmer, but how that I explain that to my

Here is my test case:

static apr_proc_t newproc = 5;
static int revolution;
void terminate()
    if (revolution < 5)
        apr_proc_kill(&newproc, 0);
int main(int argc, char *argv[])
    apr_pool_t *pool;
    apr_procattr_t *attr;
    const char *args[3];
    char sb[32];
    int q;

   if (apr_initialize() != APR_SUCCESS){
        printf("Failed to initialize APR\n");
    apr_pool_create(&pool, NULL);
    revolution = atoi(argv[1]);
    itoa(revolution + 1, sb, 10);
    args[0] = "test";
    args[1] = sb;
    args[2] = NULL;
    printf("Created %s\n", sb);
    if (revolution < 5) {
        apr_procattr_create(&attr, pool);
        apr_proc_create(&newproc, "test", args, NULL, attr, pool);
    while ((q = getch()) != 'q') {
    printf("Exiting %d\n", revolution);
    return 0;

Here I'm launching 5 processes.
The question is how to kill them all?
If I only call the TerminateProcess on the one I've created the rest 3 will
keep hanging.


View raw message