Ticket #1677: dvbsiparser.diff

File dvbsiparser.diff, 2.5 KB (added by ivor@…, 14 years ago)
  • dvbsiparser.cpp

     
    114114
    115115     /* Set flag so other processes can get past pollLock */
    116116    filterChange = true;
    117     pollLock.lock();
    118117
     118    QMutexLocker locker(&pollLock);
     119
    119120    filterChange = false;
    120121
    121122    PIDFDMap::Iterator it;
     
    124125    {
    125126       if (it.data().pid == pid)
    126127       {
    127           pollLock.unlock();
    128128          return;
    129129       }
    130130    }
     
    147147    if (fd == -1)
    148148    {
    149149        ERRNO(QString("Failed to open section filter (pid %1)").arg(pid));
    150         pollLock.unlock();
    151150        return;
    152151    }
    153152
    154153    if (ioctl(fd, DMX_SET_BUFFER_SIZE, sect_buf_size) < 0) {
    155154        ERRNO(QString("Failed to set demux buffer size (pid %1)").arg(pid));
    156         pollLock.unlock();
    157155        return;
    158156    }
    159157
    160158    if (ioctl(fd, DMX_SET_FILTER, &params) < 0)
    161159    {
    162160        ERRNO(QString("Failed to set section filter (pid %1)").arg(pid));
    163         pollLock.unlock();
    164161        return;
    165162    }
    166163
     
    175172    pollArray[pollLength].revents = 0;
    176173    pollLength++;
    177174
    178     pollLock.unlock();
    179175}
    180176
    181177void DVBSIParser::DelPid(uint pid)
     
    187183
    188184    filterChange = true;
    189185
    190     pollLock.lock();
     186    QMutexLocker locker(&pollLock);
    191187
    192188    filterChange = false;
    193189
     
    221217       x++;
    222218    }
    223219
    224     pollLock.unlock();
    225220}
    226221
    227222void DVBSIParser::DelAllPids(void)
     
    229224    PIDFDMap::Iterator it;
    230225
    231226    filterChange = true;
    232     pollLock.lock();
     227    QMutexLocker locker(&pollLock);
    233228    filterChange = false;
    234229
    235230    for (it = PIDfilterManager.begin() ; it != PIDfilterManager.end() ; ++it)
     
    239234    free(pollArray);
    240235    pollLength = 0;
    241236    pollArray = NULL;
    242 
    243     pollLock.unlock();
    244237}
    245238
    246239void DVBSIParser::StopSectionReader(void)
     
    249242   exitSectionThread = true;
    250243   DelAllPids();
    251244   filterChange = true;
    252    pollLock.lock();
     245   QMutexLocker locker(&pollLock);
    253246   filterChange = false;
    254247   free(pollArray);
    255    pollLock.unlock();
    256248}
    257249
    258250void DVBSIParser::StartSectionReader(void)
     
    273265           usleep(250);
    274266        processed = false;
    275267
    276         pollLock.lock();
     268        QMutexLocker locker(&pollLock);
    277269
    278270        int ret = poll(pollArray, pollLength, 1000);
    279271
     
    326318                pollArray[i].revents = 0;
    327319            }
    328320        }
    329 
    330         pollLock.unlock();
    331321    }
    332322
    333323    sectionThreadRunning = false;