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

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


Tim Peters wrote:

=20 [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. =20 With a Win32 flavor, which isn't what I need here. There is no distinc= t "wait for process" function in Win32, it's just another application of = the very cool WaitFor{Single,Multiple}Object(s)[Ex] APIs (which can "wait" = for sets of "handles" to "do something": kinda like Unix select(), except = not braindead ). =20 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 = in their cwait function, so it would be silly not to reuse it. BTW, a go= ogle search suggested Borland also supports a cwait function, but I have nei= ther a Borland compiler nor time to worry about that platform. You didn't w= orry much about the Cray T3E when implementing Unicode either .

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). =20 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). = If you want to risk it, you go from process pid to process handle via the = Win32 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: http://www.wdj.com/articles/1999/9907/9907c/9907c.htm

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

--=20 Marc-Andre Lemburg CEO eGenix.com Software GmbH


Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/