Ticket #9421: 0003-Don-t-bother-managing-a-child-that-failed.patch

File 0003-Don-t-bother-managing-a-child-that-failed.patch, 1.2 KB (added by beirdo, 10 years ago)
  • mythtv/libs/libmythdb/mythsystem.cpp

    From 095d52e8d5927d732b562ea77d810570ef0d22a3 Mon Sep 17 00:00:00 2001
    From: Gavin Hurlbut <ghurlbut@mythtv.org>
    Date: Tue, 25 Jan 2011 20:06:31 -0800
    Subject: [PATCH 3/3] Don't bother managing a child that failed
    
    If the child quickly failed (i.e. errored on start), there is an apparent
    race condition that makes it look like the child timed out, and if it was run
    in the background, it's deleted before the manager thread gets it, so we core
    dump when we try to remove it.
    ---
     mythtv/libs/libmythdb/mythsystem.cpp |   13 ++++++++++---
     1 files changed, 10 insertions(+), 3 deletions(-)
    
    diff --git a/mythtv/libs/libmythdb/mythsystem.cpp b/mythtv/libs/libmythdb/mythsystem.cpp
    index 93ab8e9..0828c57 100644
    a b void MythSystem::Run(time_t timeout) 
    151151
    152152    d->Fork(timeout);
    153153
    154     m_semReady.acquire(1);
    155     emit started();
    156     d->Manage();
     154    if( GetStatus() == GENERIC_EXIT_RUNNING )
     155    {
     156        m_semReady.acquire(1);
     157        emit started();
     158        d->Manage();
     159    }
     160    else
     161    {
     162        emit error(GetStatus());
     163    }
    157164}
    158165
    159166// should there be a separate 'getstatus' call? or is using