Skip to content

Commit 2d3c3f7

Browse files
committed
Add docstring
1 parent 73b97dc commit 2d3c3f7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Lib/subprocess.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,12 +2136,17 @@ def _busy_wait(self, timeout):
21362136
time.sleep(delay)
21372137

21382138
def _wait(self, timeout):
2139-
"""Internal implementation of wait() on POSIX."""
2139+
"""Internal implementation of wait() on POSIX.
2140+
2141+
Uses efficient pidfd_open() + poll() on Linux or kqueue()
2142+
on macOS/BSD when available. Falls back to polling
2143+
waitpid(WNOHANG) otherwise.
2144+
"""
21402145
if self.returncode is not None:
21412146
return self.returncode
21422147

21432148
if timeout is not None:
2144-
# Try fast wait first (pidfd on Linux, kqueue on BSD/macOS).
2149+
# Try efficient wait first.
21452150
if self._wait_pidfd(timeout) or self._wait_kqueue(timeout):
21462151
with self._waitpid_lock:
21472152
if self.returncode is not None:

0 commit comments

Comments
 (0)