diff options
author | wm4 <wm4@nowhere> | 2013-11-30 22:47:17 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-30 22:47:26 +0100 |
commit | 9d8573cfe85fa1810ec6a18c584e920b47da1dad (patch) | |
tree | 729de7d7c13b8e7908c7bd77e42dd010cda7bb2e /audio/filter/af.h | |
parent | 95cfe58e3db9d939abe7a9a26116c1d576eed60b (diff) | |
download | mpv-9d8573cfe85fa1810ec6a18c584e920b47da1dad.tar.bz2 mpv-9d8573cfe85fa1810ec6a18c584e920b47da1dad.tar.xz |
Prevent creating zombies
The "run" input command does fork+exec to spawn child processes. But it
doesn't cleanup the child processes, so they are left as zombies until
mpv terminates. Leaving zombie processes around is not very nice, so
employ a simple trick to let pid 1 take care of this: we fork twice, and
when the first fork exits, the second fork becomes orphaned and becomes
pid 1's child. It becomes pid 1's responsibility to cleanup the process.
The advantage is that we don't need extra logic to cleanup the spawned
process, which could have an arbitrary lifetime.
This is e.g. described here: http://yarchive.net/comp/zombie_process.html
Also use _exit() instead of exit(). It's not really sane to run cleanup
handlers (atexit() etc.) inside a forked process.
Diffstat (limited to 'audio/filter/af.h')
0 files changed, 0 insertions, 0 deletions