1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed 'zombie' processes when closing a pipe

This commit is contained in:
Klaus Schmidinger 2002-03-09 11:51:56 +01:00
parent a9fd732a72
commit ac5aecb8eb
3 changed files with 17 additions and 6 deletions

View File

@ -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

View File

@ -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).

View File

@ -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) {