Ignore:
Timestamp:
Nov 10, 2017, 12:00:15 AM (8 years ago)
Author:
dmik
Message:

python: Use spawn instead of fork in subprocess.

This significantly improves performance when running many external programs.
See #275 for more details.

Note that this commit also makes os.pipe use pipe() instead of socketpair() and
this in turn fixes #267. Note that socketpair() is still available via socket.socketpair()
in Python.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/trunk/Modules/posixmodule.c

    r1253 r1254  
    48214821    i = pipe_err = 0;
    48224822    while ((pipe_err == 0) && (i < file_count))
    4823 #ifndef __KLIBC__
    48244823        pipe_err = pipe((int *)&p_fd[i++]);
    4825 #else
    4826         pipe_err = socketpair(AF_UNIX, SOCK_STREAM,0,(int *)&p_fd[i++]);
    4827 #endif
    48284824    if (pipe_err < 0)
    48294825    {
     
    69626958    int res;
    69636959    Py_BEGIN_ALLOW_THREADS
    6964 #ifndef __KLIBC__
    69656960    res = pipe(fds);
    6966 #else
    6967     res = socketpair(AF_UNIX, SOCK_STREAM,0, fds);
    6968 #endif
    69696961    Py_END_ALLOW_THREADS
    69706962    if (res != 0)
Note: See TracChangeset for help on using the changeset viewer.