bool CEpgContainer::PersistAll(void) { bool bReturn(true); CSingleLock lock(m_critSection); for (map<unsigned int, CEpg *>::iterator it = m_epgs.begin(); it != m_epgs.end() && !m_bStop; it++) { CEpg *epg = it->second; if (epg && epg->NeedsSave()) { lock.Leave(); bReturn &= epg->Persist(); lock.Enter(); } } return bReturn; }
bool CEpgContainer::PersistAll(void) { bool bReturn(true); m_critSection.lock(); std::map<unsigned int, CEpg*> copy = m_epgs; m_critSection.unlock(); for (EPGMAP_CITR it = copy.begin(); it != copy.end() && !m_bStop; it++) { CEpg *epg = it->second; if (epg && epg->NeedsSave()) { bReturn &= epg->Persist(); } } return bReturn; }