Questions about os.waitpid(pid, options) on windows

Christopher Head chead at is.invalid
Sat Jul 16 01:40:24 EDT 2011


On Mon, 11 Jul 2011 20:59:29 -0700 (PDT)
Fan <zjuwufan at gmail.com> wrote:

> It seems that waitpid take process handle instead of process id as the
> first parameter on Windows.  On Unices platform, the first parameter
> is process id.
> 
> This interface is a little bit confusing. What's the purpose for such
> a design?
> 
> Thanks a lot,
> Fan

I would assume it's because that's how the underlying OS primitives
work. Under Windows, concepts of "process ID" and "process handle" both
exist (and are separate), and the functions that wait for events to
occur (WaitForSingleObject, WaitForMultipleObjects, and so on) take
handles of various sorts, including process handles. Under Linux, there
is no such thing as a process handle, only a process ID, and waitpid
(the system call) takes a process ID.

Chris



More information about the Python-list mailing list