Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
epg: don't keep the mutex locked in CEpgContainer::RemoveOldEntries()…
Browse files Browse the repository at this point in the history
… and only clean up the db if it's actually being used
  • Loading branch information
opdenkamp committed May 29, 2011
1 parent 6e0b71a commit d62f45a
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions xbmc/epg/EpgContainer.cpp
Expand Up @@ -245,34 +245,33 @@ bool CEpgContainer::LoadSettings(void)

bool CEpgContainer::RemoveOldEntries(void)
{
bool bReturn = false;
CSingleLock lock(m_critSection);

CLog::Log(LOGINFO, "EpgContainer - %s - removing old EPG entries",
__FUNCTION__);

CDateTime now = CDateTime::GetCurrentDateTime().GetAsUTCDateTime();

if (!m_database.Open())
{
CLog::Log(LOGERROR, "EpgContainer - %s - cannot open the database",
__FUNCTION__);
return bReturn;
}

/* call Cleanup() on all known EPG tables */
for (unsigned int iEpgPtr = 0; iEpgPtr < size(); iEpgPtr++)
{
at(iEpgPtr)->Cleanup(now);
CEpg *epg = at(iEpgPtr);
if (epg)
at(iEpgPtr)->Cleanup(now);
}

/* remove the old entries from the database */
bReturn = m_database.DeleteOldEpgEntries();
if (!m_bIgnoreDbForClient)
{
if (m_database.Open())
{
m_database.DeleteOldEpgEntries();
m_database.Close();
}
}

if (bReturn)
CDateTime::GetCurrentDateTime().GetAsTime(m_iLastEpgCleanup);
CSingleLock lock(m_critSection);
CDateTime::GetCurrentDateTime().GetAsTime(m_iLastEpgCleanup);

return bReturn;
return true;
}

CEpg *CEpgContainer::CreateEpg(int iEpgId)
Expand Down

0 comments on commit d62f45a

Please sign in to comment.