Ticket #5143: libs_libmythtv_dvbstreamhandler.cpp-check_pthread_create.patch

File libs_libmythtv_dvbstreamhandler.cpp-check_pthread_create.patch, 1015 bytes (added by Erik Hovland <erik@…>, 12 years ago)

check pthread_create and report on failure

  • libs/libmythtv/dvbstreamhandler.cpp

    pthread_create should be checked.
    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     libs/libmythtv/dvbstreamhandler.cpp |   10 ++++++++--
     1 files changed, 8 insertions(+), 2 deletions(-)
    
    diff --git a/libs/libmythtv/dvbstreamhandler.cpp b/libs/libmythtv/dvbstreamhandler.cpp
    index cfa3321..ea32ccd 100644
    a b void DVBStreamHandler::Start(void) 
    189189    if (!IsRunning())
    190190    {
    191191        QMutex is_running_lock;
    192         pthread_create(&_reader_thread, NULL,
    193                        run_dvb_stream_handler_thunk, this);
     192        int rval = pthread_create(&_reader_thread, NULL,
     193                                  run_dvb_stream_handler_thunk, this);
     194        if (rval < 0)
     195        {
     196            VERBOSE(VB_IMPORTANT, LOC_ERR + QString("DVBStreamHandler::Start - "
     197                    "failed creating thread. Error %1").arg(strerror(errno)));
     198            return;
     199        }
    194200
    195201        while (!IsRunning())
    196202        {