diff --git a/docs/internals.rst b/docs/internals.rst index 7db4262a..a0ad342d 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -338,6 +338,9 @@ Helper Functions .. autofunction:: set_block .. autofunction:: io_op +.. currentmodule:: mitogen.parent +.. autofunction:: close_nonstandard_fds +.. autofunction:: create_socketpair .. currentmodule:: mitogen.master .. autofunction:: get_child_modules diff --git a/mitogen/parent.py b/mitogen/parent.py index ef6c69b2..44504258 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -157,6 +157,14 @@ def close_nonstandard_fds(): def create_socketpair(): + """ + Create a :func:`socket.socketpair` to use for use as a child process's UNIX + stdio channels. As socket pairs are bidirectional, they are economical on + file descriptor usage as the same descriptor can be used for ``stdin`` and + ``stdout``. As they are sockets their buffers are tunable, allowing large + buffers to be configured in order to improve throughput for file transfers + and reduce :class:`mitogen.core.Broker` IO loop iterations. + """ parentfp, childfp = socket.socketpair() parentfp.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF,