parent: docstring improvements, cfmakeraw() regression.

pull/607/head
David Wilson 6 years ago
parent c7ebb39ad4
commit f66611dc83

@ -221,9 +221,11 @@ def flags(names):
def cfmakeraw(tflags): def cfmakeraw(tflags):
"""Given a list returned by :py:func:`termios.tcgetattr`, return a list """
Given a list returned by :py:func:`termios.tcgetattr`, return a list
modified in a manner similar to the `cfmakeraw()` C library function, but modified in a manner similar to the `cfmakeraw()` C library function, but
additionally disabling local echo.""" additionally disabling local echo.
"""
# BSD: github.com/freebsd/freebsd/blob/master/lib/libc/gen/termios.c#L162 # BSD: github.com/freebsd/freebsd/blob/master/lib/libc/gen/termios.c#L162
# Linux: github.com/lattera/glibc/blob/master/termios/cfmakeraw.c#L20 # Linux: github.com/lattera/glibc/blob/master/termios/cfmakeraw.c#L20
iflag, oflag, cflag, lflag, ispeed, ospeed, cc = tflags iflag, oflag, cflag, lflag, ispeed, ospeed, cc = tflags
@ -231,7 +233,7 @@ def cfmakeraw(tflags):
'ISTRIP INLCR ICRNL IXON IGNPAR') 'ISTRIP INLCR ICRNL IXON IGNPAR')
iflag &= ~flags('IGNBRK BRKINT PARMRK') iflag &= ~flags('IGNBRK BRKINT PARMRK')
oflag &= ~flags('OPOST') oflag &= ~flags('OPOST')
lflag &= ~flags('ECHO ECHOE ECHOK ECHONL ICANON ISIG' lflag &= ~flags('ECHO ECHOE ECHOK ECHONL ICANON ISIG '
'IEXTEN NOFLSH TOSTOP PENDIN') 'IEXTEN NOFLSH TOSTOP PENDIN')
cflag &= ~flags('CSIZE PARENB') cflag &= ~flags('CSIZE PARENB')
cflag |= flags('CS8 CREAD') cflag |= flags('CS8 CREAD')
@ -251,12 +253,11 @@ def disable_echo(fd):
def create_socketpair(size=None): def create_socketpair(size=None):
""" """
Create a :func:`socket.socketpair` to use for use as a child process's UNIX Create a :func:`socket.socketpair` for use as a child's UNIX stdio
stdio channels. As socket pairs are bidirectional, they are economical on channels. As socketpairs are bidirectional, they are economical on file
file descriptor usage as the same descriptor can be used for ``stdin`` and descriptor usage as one descriptor can be used for ``stdin`` and
``stdout``. As they are sockets their buffers are tunable, allowing large ``stdout``. As they are sockets their buffers are tunable, allowing large
buffers to be configured in order to improve throughput for file transfers buffers to improve file transfer throughput and reduce IO loop iterations.
and reduce :class:`mitogen.core.Broker` IO loop iterations.
""" """
parentfp, childfp = socket.socketpair() parentfp, childfp = socket.socketpair()
parentfp.setsockopt(socket.SOL_SOCKET, parentfp.setsockopt(socket.SOL_SOCKET,
@ -599,8 +600,8 @@ class TimerList(object):
""" """
Efficiently manage a list of cancellable future events relative to wall Efficiently manage a list of cancellable future events relative to wall
clock time. An instance of this class is installed as clock time. An instance of this class is installed as
:attr:`mitogen.master.Broker.timers` by default, and installed as :attr:`mitogen.master.Broker.timers` by default, and as
:attr:`mitogen.core.Broker.timers` in a child context after a call to :attr:`mitogen.core.Broker.timers` in children after a call to
:func:`mitogen.parent.upgrade_router`. :func:`mitogen.parent.upgrade_router`.
You can use :class:`TimerList` to cause the broker to wake at arbitrary You can use :class:`TimerList` to cause the broker to wake at arbitrary

Loading…
Cancel
Save