diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 6671dff1a..8e0fd8941 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -902,9 +902,9 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo; CChannelEvent *event; - NeutrinoAPI->mutex.lock(); + NeutrinoAPI->Lock(); event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]; - NeutrinoAPI->mutex.unlock(); + NeutrinoAPI->Unlock(); if (event) { int percentage = 100; @@ -968,9 +968,9 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel * } else { CChannelEvent *event; - NeutrinoAPI->mutex.lock(); + NeutrinoAPI->Lock(); event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]; - NeutrinoAPI->mutex.unlock(); + NeutrinoAPI->Unlock(); if (event && isEPGdetails) { result += string_printf("%u " @@ -1638,9 +1638,9 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) { CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin(); for (; !(cit.EndOfChannels()); cit++) { CZapitChannel * channel = *cit; - NeutrinoAPI->mutex.lock(); + NeutrinoAPI->Lock(); event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]; - NeutrinoAPI->mutex.unlock(); + NeutrinoAPI->Unlock(); if (event) { if (!isExt) { hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/neutrinoapi.cpp index 97f128c19..22742c07f 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoapi.cpp @@ -136,6 +136,8 @@ CNeutrinoAPI::CNeutrinoAPI() EventServer->registerEvent2( NeutrinoMessages::EVT_HDMI_CEC_STANDBY, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock"); EventServer->registerEvent2( NeutrinoMessages::EVT_SET_MUTE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock"); EventServer->registerEvent2( NeutrinoMessages::EVT_SET_VOLUME, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock"); + + pmutex = new OpenThreads::Mutex(OpenThreads::Mutex::MUTEX_RECURSIVE); } //------------------------------------------------------------------------- @@ -153,6 +155,8 @@ CNeutrinoAPI::~CNeutrinoAPI(void) delete Timerd; if (EventServer) delete EventServer; + + delete pmutex; } //------------------------------------------------------------------------- @@ -172,7 +176,7 @@ void CNeutrinoAPI::UpdateBouquets(void) //------------------------------------------------------------------------- void CNeutrinoAPI::ZapTo(const char * const target) { - OpenThreads::ScopedLock lock(mutex); + OpenThreads::ScopedPointerLock lock(pmutex); t_channel_id channel_id; sscanf(target, @@ -184,7 +188,7 @@ void CNeutrinoAPI::ZapTo(const char * const target) //------------------------------------------------------------------------- void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id) { - OpenThreads::ScopedLock lock(mutex); + OpenThreads::ScopedPointerLock lock(pmutex); if (channel_id == Zapit->getCurrentServiceID()) { //printf("Kanal ist aktuell\n"); @@ -198,7 +202,7 @@ void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id) void CNeutrinoAPI::ZapToSubService(const char * const target) { - OpenThreads::ScopedLock lock(mutex); + OpenThreads::ScopedPointerLock lock(pmutex); t_channel_id channel_id; sscanf(target, @@ -211,7 +215,7 @@ void CNeutrinoAPI::ZapToSubService(const char * const target) //------------------------------------------------------------------------- t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_name) { - OpenThreads::ScopedLock lock(mutex); + OpenThreads::ScopedPointerLock lock(pmutex); //FIXME depending on mode missing //int mode = Zapit->getMode(); t_channel_id channel_id = (t_channel_id)-1; @@ -269,7 +273,7 @@ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10]) bool CNeutrinoAPI::GetChannelEvents(void) { - OpenThreads::ScopedLock lock(mutex); + OpenThreads::ScopedPointerLock lock(pmutex); eList.clear(); CEitManager::getInstance()->getChannelEvents(eList); CChannelEventList::iterator eventIterator; @@ -289,7 +293,7 @@ bool CNeutrinoAPI::GetChannelEvents(void) std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id) { - OpenThreads::ScopedLock lock(mutex); + OpenThreads::ScopedPointerLock lock(pmutex); return CServiceManager::getInstance()->GetServiceName(channel_id); } @@ -428,7 +432,7 @@ std::string CNeutrinoAPI::getVideoAspectRatioAsString(void) //------------------------------------------------------------------------- int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString) { - OpenThreads::ScopedLock lock(mutex); + OpenThreads::ScopedPointerLock lock(pmutex); int newRatioInt = -1; for(int i=0;i<(int)sizeof(videoformat_names);i++) if( videoformat_names[i] == newRatioString){ @@ -484,7 +488,7 @@ std::string CNeutrinoAPI::getCryptInfoAsString(void) std::string casys[11]= {"Irdeto:","Betacrypt:","Seca:","Viaccess:","Nagra:","Conax: ","Cryptoworks:","Videoguard:","EBU:","XCrypt:","PowerVU:"}; int caids[] = { 0x600, 0x1700, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 }; - OpenThreads::ScopedLock lock(mutex); + OpenThreads::ScopedPointerLock lock(pmutex); CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); if(channel) { for (unsigned short i = 0; i < 11; i++) { diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.h b/src/nhttpd/tuxboxapi/neutrinoapi.h index 6312229a1..5e0a90596 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/neutrinoapi.h @@ -25,7 +25,7 @@ bool _initialize_iso639_map(void); //------------------------------------------------------------------------- class CNeutrinoAPI { - OpenThreads::Mutex mutex; + OpenThreads::Mutex *pmutex; // Clientlibs CSectionsdClient *Sectionsd; CZapitClient *Zapit; @@ -88,6 +88,8 @@ public: CChannelEventList eList; CNeutrinoYParser *NeutrinoYParser; CControlAPI *ControlAPI; + void Lock() { pmutex->lock(); } + void Unlock() { pmutex->unlock(); } friend class CNeutrinoYParser; // Backreference friend class CControlAPI; diff --git a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp index 5137dad85..1d0f4ae4e 100644 --- a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -359,9 +359,9 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: { CZapitChannel * channel = channels[j]; CChannelEvent *event; - NeutrinoAPI->mutex.lock(); + NeutrinoAPI->Lock(); event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()]; - NeutrinoAPI->mutex.unlock(); + NeutrinoAPI->Unlock(); classname = (i++ & 1) ? 'a' : 'b'; if (channel->getChannelID() == current_channel)