Skip to content

Commit 94d4c4a

Browse files
committed
Create constant for default number of pages per pipe
1 parent da10f8e commit 94d4c4a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Lib/multiprocessing/connection.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@ def _get_more_data(self, ov, maxsize):
361361
f.write(ov.getbuffer())
362362
return f
363363

364+
"""
365+
The default size of a pipe on Linux systems is 16 times the base page size:
366+
https://man7.org/linux/man-pages/man7/pipe.7.html
367+
"""
368+
PAGES_PER_PIPE = 16
364369

365370
class Connection(_ConnectionBase):
366371
"""
@@ -380,7 +385,7 @@ def _close(self, _close=os.close):
380385
_write = os.write
381386
_read = os.read
382387
_base_page_size = os.sysconf(os.sysconf_names['SC_PAGESIZE'])
383-
_default_pipe_size = _base_page_size * 16
388+
_default_pipe_size = _base_page_size * PAGES_PER_PIPE
384389

385390
def _send(self, buf, write=_write):
386391
remaining = len(buf)

0 commit comments

Comments
 (0)