[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.352,1.353

M.-A. Lemburg mal@lemburg.com
Fri, 01 Feb 2002 22:58:34 +0100

Tim Peters wrote:
> [MAL]
> > I'm no Win32 expert, just though that the code in the win32process
> > module (which is part of win32all) probably already provides code in
> > this area.
> With a Win32 flavor, which isn't what I need here.  There is no distinc=
> "wait for process" function in Win32, it's just another application of =
> very cool WaitFor{Single,Multiple}Object(s)[Ex] APIs (which can "wait" =
> sets of "handles" to "do something":  kinda like Unix select(), except =
> braindead <wink>).
> That's fine, but what I specifically needed (for a Zope Corp project) w=
as a
> Unixish waitpid() workalike.  MS already did most of the work for that =
> their _cwait function, so it would be silly not to reuse it.  BTW, a go=
> search suggested Borland also supports a cwait function, but I have nei=
> a Borland compiler nor time to worry about that platform.  You didn't w=
> much about the Cray T3E when implementing Unicode either <wink>.

Touch=E9 :-)

> > Another candidate for Windows emulation would be os.kill().
> > win32process has TerminateProcess() which could probably be used
> > for this (no idea however, how you get from a PID to a process handle
> > on Windows).
> I'm not looking for random functions to implement; if I *need* an
> os.kill()-alike, I'll do one, but I don't expect the need.
> TerminateProcess() is a dangerous function on Windows (read the docs). =
> you want to risk it, you go from process pid to process handle via the =
> OpenProcess() function.

Too bad, because I have will have a need for porting a multi-process
application to Windows sometime soon :-)

Here's an article I found on the topic:

What a hack... now I know why you don't want to use Win32 APIs ;-)

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/