Skip to content

Commit

Permalink
Fixed sending signals to subprocesses
Browse files Browse the repository at this point in the history
It seemed on timeout, we never killed the process as we only sent signals if in
RUNNING state, not TIMEOUT state as well.  Ooops.
  • Loading branch information
Beirdo committed Jun 20, 2011
1 parent 40f72ef commit 38456f1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions mythtv/libs/libmythbase/system-unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,14 @@ MythSystemUnix::~MythSystemUnix(void)

void MythSystemUnix::Term(bool force)
{
if( (GetStatus() != GENERIC_EXIT_RUNNING) || (m_pid <= 0) )
int status = GetStatus();
if( (status != GENERIC_EXIT_RUNNING && status != GENERIC_EXIT_TIMEOUT) ||
(m_pid <= 0) )
{
VERBOSE(VB_GENERAL | VB_EXTRA, QString("Terminate skipped. Status: %1")
.arg(status));
return;
}

Signal(SIGTERM);
if( force )
Expand All @@ -543,8 +549,15 @@ void MythSystemUnix::Term(bool force)

void MythSystemUnix::Signal( int sig )
{
if( (GetStatus() != GENERIC_EXIT_RUNNING) || (m_pid <= 0) )
int status = GetStatus();
if( (status != GENERIC_EXIT_RUNNING && status != GENERIC_EXIT_TIMEOUT) ||
(m_pid <= 0) )
{
VERBOSE(VB_GENERAL | VB_EXTRA, QString("Signal skipped. Status: %1")
.arg(status));
return;
}

VERBOSE(VB_GENERAL, QString("Child PID %1 killed with %2")
.arg(m_pid).arg(strsignal(sig)));
kill((GetSetting("SetPGID") ? -m_pid : m_pid), sig);
Expand Down

0 comments on commit 38456f1

Please sign in to comment.