Skip to content

Commit

Permalink
Merge pull request #169 from a1rwulf/threading
Browse files Browse the repository at this point in the history
Fix multithreading issues
  • Loading branch information
ksooo committed Dec 22, 2017
2 parents 53f94ec + 58448c4 commit cbd4f5a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pvr.iptvsimple/addon.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.iptvsimple"
version="3.3.2"
version="3.3.3"
name="PVR IPTV Simple Client"
provider-name="nightik">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.iptvsimple/changelog.txt
@@ -1,3 +1,6 @@
v3.3.3
- Fixed multithreading issues

v3.3.0
- Updated to PVR addon API v5.7.0

Expand Down
10 changes: 10 additions & 0 deletions src/PVRIptvData.cpp
Expand Up @@ -573,11 +573,13 @@ bool PVRIptvData::LoadGenres(void)

int PVRIptvData::GetChannelsAmount(void)
{
P8PLATFORM::CLockObject lock(m_mutex);
return m_channels.size();
}

PVR_ERROR PVRIptvData::GetChannels(ADDON_HANDLE handle, bool bRadio)
{
P8PLATFORM::CLockObject lock(m_mutex);
for (unsigned int iChannelPtr = 0; iChannelPtr < m_channels.size(); iChannelPtr++)
{
PVRIptvChannel &channel = m_channels.at(iChannelPtr);
Expand All @@ -603,6 +605,7 @@ PVR_ERROR PVRIptvData::GetChannels(ADDON_HANDLE handle, bool bRadio)

bool PVRIptvData::GetChannel(const PVR_CHANNEL &channel, PVRIptvChannel &myChannel)
{
P8PLATFORM::CLockObject lock(m_mutex);
for (unsigned int iChannelPtr = 0; iChannelPtr < m_channels.size(); iChannelPtr++)
{
PVRIptvChannel &thisChannel = m_channels.at(iChannelPtr);
Expand All @@ -625,11 +628,13 @@ bool PVRIptvData::GetChannel(const PVR_CHANNEL &channel, PVRIptvChannel &myChann

int PVRIptvData::GetChannelGroupsAmount(void)
{
P8PLATFORM::CLockObject lock(m_mutex);
return m_groups.size();
}

PVR_ERROR PVRIptvData::GetChannelGroups(ADDON_HANDLE handle, bool bRadio)
{
P8PLATFORM::CLockObject lock(m_mutex);
std::vector<PVRIptvChannelGroup>::iterator it;
for (it = m_groups.begin(); it != m_groups.end(); ++it)
{
Expand All @@ -651,6 +656,7 @@ PVR_ERROR PVRIptvData::GetChannelGroups(ADDON_HANDLE handle, bool bRadio)

PVR_ERROR PVRIptvData::GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP &group)
{
P8PLATFORM::CLockObject lock(m_mutex);
PVRIptvChannelGroup *myGroup;
if ((myGroup = FindGroup(group.strGroupName)) != NULL)
{
Expand All @@ -677,6 +683,7 @@ PVR_ERROR PVRIptvData::GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHA

PVR_ERROR PVRIptvData::GetEPGForChannel(ADDON_HANDLE handle, const PVR_CHANNEL &channel, time_t iStart, time_t iEnd)
{
P8PLATFORM::CLockObject lock(m_mutex);
std::vector<PVRIptvChannel>::iterator myChannel;
for (myChannel = m_channels.begin(); myChannel < m_channels.end(); ++myChannel)
{
Expand Down Expand Up @@ -1058,6 +1065,7 @@ void PVRIptvData::ApplyChannelsLogosFromEPG()

void PVRIptvData::ReaplyChannelsLogos(const char * strNewPath)
{
P8PLATFORM::CLockObject lock(m_mutex);
if (strlen(strNewPath) > 0)
{
m_strLogoPath = strNewPath;
Expand All @@ -1070,6 +1078,7 @@ void PVRIptvData::ReaplyChannelsLogos(const char * strNewPath)

void PVRIptvData::ReloadEPG(const char * strNewPath)
{
P8PLATFORM::CLockObject lock(m_mutex);
if (strNewPath != m_strXMLTVUrl)
{
m_strXMLTVUrl = strNewPath;
Expand All @@ -1088,6 +1097,7 @@ void PVRIptvData::ReloadEPG(const char * strNewPath)

void PVRIptvData::ReloadPlayList(const char * strNewPath)
{
P8PLATFORM::CLockObject lock(m_mutex);
if (strNewPath != m_strM3uUrl)
{
m_strM3uUrl = strNewPath;
Expand Down
1 change: 1 addition & 0 deletions src/PVRIptvData.h
Expand Up @@ -132,4 +132,5 @@ class PVRIptvData : public P8PLATFORM::CThread
std::vector<PVRIptvChannel> m_channels;
std::vector<PVRIptvEpgChannel> m_epg;
std::vector<PVRIptvEpgGenre> m_genres;
P8PLATFORM::CMutex m_mutex;
};

0 comments on commit cbd4f5a

Please sign in to comment.