A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2013-July/127550.html below:

[Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)

[Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446) [Python-Dev] Inherance of file descriptor and handles on Windows (PEP 446)Richard Oudkerk shibturn at gmail.com
Thu Jul 25 00:52:29 CEST 2013
On 24/07/2013 10:50pm, Victor Stinner wrote:
> So would it be possible to implement the pass_fds parameter of
> subprocess using spawnl() or the undocumented fields?

Not in a non-racy way.

spawnv() calls CreateProcess() with bInheritHandles=TRUE, so *all* 
inheritable handles are inherited by the child.

The passing of the arrays of fds just makes the fds in the child process 
match the fds in the parent.

If you have a Visual Studio installed then the relevant code is in

    .../Microsoft Visual Studio 10.0/VC/crt/src/dospawn.c

> And is it possible to close all handles except one (implement "pass_handles")?

I don't know how to do that.

>> In the experimental branch of multiprocessing, child processes
>> no longer inherit unnecessary handles.
>
> Where is this branch? How did you create the channel between the
> manager and the worker?

     http://hg.python.org/sandbox/sbt/

The parent creates a pipe and starts the child process.  The pid of the 
parent, and the handle for the read end of the pipe are passed on the 
command line.  Then the child "steals" the handle from the parent using 
OpenProcess() and DuplicateHandle() using the DUPLICATE_CLOSE_SOURCE flag.

-- 
Richard

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4