Ticket #1603: event-locking-0.19.diff

File event-locking-0.19.diff, 3.0 KB (added by Stuart Auchterlonie, 18 years ago)

Provide locking for Events Map

  • libs/libmythtv/siparser.cpp

    old new  
    206206                case EVENTS:
    207207                    while (Table[EVENTS]->GetEmitID(key0,key1))
    208208                    {
     209                        QMutexLocker lock (&(((EventHandler*) Table[EVENTS])->EventsLock));
    209210                        EventHandler *hdl = (EventHandler*) Table[EVENTS];
    210211                        emit EventsReady(&(hdl->Events[key0]));
    211212                    }
     
    14881489        }
    14891490#endif
    14901491
     1492        QMutexLocker lock (&(((EventHandler*) Table[EVENTS])->EventsLock));
    14911493        QMap2D_Events &events = ((EventHandler*) Table[EVENTS])->Events;
    14921494        events[head->table_id_ext][event.EventID] = event;
    14931495        pos += descriptors_length;
     
    24872489        pos += (descriptors_length + 2);
    24882490        EITFixUp(e);
    24892491
     2492        QMutexLocker lock (&(((EventHandler*) Table[EVENTS])->EventsLock));
    24902493        EventHandler *eh = (EventHandler*) Table[EVENTS];
    24912494        eh->Events[head->table_id_ext][event_id] = e;
    24922495    }
     
    25092512    if (!atsc_src_id)
    25102513        return;
    25112514
     2515    QMutexLocker lock (&(((EventHandler*) Table[EVENTS])->EventsLock));
    25122516    EventHandler *eh = (EventHandler*) Table[EVENTS];
    25132517    if (eh->Events[source_id].contains(etm_id2) &&
    25142518        eh->Events[source_id][etm_id2].ETM_Location)
  • libs/libmythtv/sitypes.cpp

    old new  
    884884        }
    885885        if (AllComplete && (SIStandard == SI_STANDARD_ATSC))
    886886        {
     887            QMutexLocker lock(&EventsLock);
    887888            for (e = Events[s.key()].begin() ; e != Events[s.key()].end() ; ++e)
    888889            {
    889890                if (e.data().ETM_Location != 0)
     
    946947
    947948            if (AllComplete && (SIStandard == SI_STANDARD_ATSC))
    948949            {
     950                QMutexLocker lock(&EventsLock);
    949951                for (e = Events[s.key()].begin() ; e != Events[s.key()].end() ; ++e)
    950952                {
    951953                    if (e.data().ETM_Location != 0)
  • libs/libmythtv/sitypes.h

    old new  
    1212#include <qmap.h>
    1313#include <qstringlist.h>
    1414#include <qdatetime.h>
     15#include <qmutex.h>
    1516
    1617#include "config.h"
    1718#ifdef HAVE_STDINT_H
     
    612613    QMap_pidHandler        ETTpid;
    613614    QMap2D_Events          Events;
    614615    QMap_bool              TrackerSetup;
     616    QMutex                 EventsLock;
    615617};
    616618
    617619class ServiceHandler : public TableHandler