stripe / subprocess

A port of Python's subprocess module to Ruby
MIT License
208 stars 17 forks source link

Wakeup SIGCHLD listeners on a separate thread. #35

Closed nelhage-stripe closed 7 years ago

nelhage-stripe commented 7 years ago

This enables us to properly grab the @sigchld_mutex and synchronize with writers.

It turns out that signal handlers execute on the main thread and may interleave with other writers. This manifested as handle_sigchld writeing to pipes that had already been closed (by the IO.pipe) block, resulting in nasty exceptions.

By grabbing the lock, we ensure that we serialize reading the list of wakeup pipes properly with respect to writers.

r? @andrew-stripe

andrew-stripe commented 7 years ago

👍