diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-03-09 11:51:56 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-03-09 11:51:56 +0100 |
commit | ac5aecb8eb6d6979877dbf9db813eb8d6b1a6ae6 (patch) | |
tree | dbea8faa967637fe945fa7cc2a32f9b2d069f1ce | |
parent | a9fd732a721336f4cd34eabfd02afde4e9516065 (diff) | |
download | vdr-ac5aecb8eb6d6979877dbf9db813eb8d6b1a6ae6.tar.gz vdr-ac5aecb8eb6d6979877dbf9db813eb8d6b1a6ae6.tar.bz2 |
Fixed 'zombie' processes when closing a pipe
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | HISTORY | 3 | ||||
-rw-r--r-- | thread.c | 19 |
3 files changed, 17 insertions, 6 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 03e8bbe7..a00f6633 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -146,6 +146,7 @@ Artur Skawina <skawina@geocities.com> Werner Fink <werner@suse.de> for making I/O more robust by handling EINTR for fixing closing all unused file descriptors when opening a pipe + for helping to debug leftover 'zombie' processes when closing a pipe Rolf Hakenes <hakenes@hippomi.de> for providing 'libdtv' and adapting the EIT mechanisms to it @@ -1083,3 +1083,6 @@ Video Disk Recorder Revision History - Fixed resetting 'mute' state when setting the volume to a non-zero value. - Added log messages when deleting recordings in case the disk runs full while recording. +- Fixed closing a pipe (used for replaying Dolby Digital audio), which + sometimes left 'zombie' processes behind (thanks to Werner Fink for helping + to debug this one). @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: thread.c 1.18 2002/02/23 13:49:06 kls Exp $ + * $Id: thread.c 1.19 2002/03/09 11:51:56 kls Exp $ */ #include "thread.h" @@ -327,14 +327,21 @@ int cPipe::Close(void) f = NULL; } - if (pid >= 0) { + if (pid > 0) { int status = 0; - struct rusage ru; int i = 5; - while (ret == -1 && i > 0) { - usleep(1000); - ret = wait4(pid, &status, WNOHANG, &ru); + while (i > 0) { + ret = waitpid(pid, &status, WNOHANG); + if (ret < 0) { + if (errno != EINTR && errno != ECHILD) { + LOG_ERROR; + break; + } + } + else if (ret == pid) + break; i--; + usleep(100000); } if (!i) { |