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

Tim Peters wrote:
[MAL]
Wouldn't it be better to use Win32 APIs for this ? That way, other compilers on Windows will have a chance to use the same code.
I have no reason to believe that other compilers on Windows don't follow MS in this respect; they usually seem to ape the same functions, sometimes with or without leading underscores, or other trivial name changes. If you want to wrestle with the Win32 API, be my guest <wink>.
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. 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). Anyway, just a thought... -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/

[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 distinct "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 <wink>). That's fine, but what I specifically needed (for a Zope Corp project) was 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 google search suggested Borland also supports a cwait function, but I have neither a Borland compiler nor time to worry about that platform. You didn't worry much about the Cray T3E when implementing Unicode either <wink>.
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). If you want to risk it, you go from process pid to process handle via the Win32 OpenProcess() function.

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 distinct "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 <wink>).
That's fine, but what I specifically needed (for a Zope Corp project) was 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 google search suggested Borland also supports a cwait function, but I have neither a Borland compiler nor time to worry about that platform. You didn't worry much about the Cray T3E when implementing Unicode either <wink>.
Touché :-)
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). 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 ;-) -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/
participants (2)
-
M.-A. Lemburg
-
Tim Peters