mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-10 07:08:28 +02:00
nhttp: change mutex type to recursive
Origin commit data
------------------
Commit: ecb5e06128
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2016-02-16 (Tue, 16 Feb 2016)
This commit is contained in:
@@ -902,9 +902,9 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann
|
|||||||
|
|
||||||
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
|
CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo;
|
||||||
CChannelEvent *event;
|
CChannelEvent *event;
|
||||||
NeutrinoAPI->mutex.lock();
|
NeutrinoAPI->Lock();
|
||||||
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
||||||
NeutrinoAPI->mutex.unlock();
|
NeutrinoAPI->Unlock();
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
int percentage = 100;
|
int percentage = 100;
|
||||||
@@ -968,9 +968,9 @@ std::string CControlAPI::_GetBouquetWriteItem(CyhookHandler *hh, CZapitChannel *
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CChannelEvent *event;
|
CChannelEvent *event;
|
||||||
NeutrinoAPI->mutex.lock();
|
NeutrinoAPI->Lock();
|
||||||
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
||||||
NeutrinoAPI->mutex.unlock();
|
NeutrinoAPI->Unlock();
|
||||||
|
|
||||||
if (event && isEPGdetails) {
|
if (event && isEPGdetails) {
|
||||||
result += string_printf("%u "
|
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();
|
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
|
||||||
for (; !(cit.EndOfChannels()); cit++) {
|
for (; !(cit.EndOfChannels()); cit++) {
|
||||||
CZapitChannel * channel = *cit;
|
CZapitChannel * channel = *cit;
|
||||||
NeutrinoAPI->mutex.lock();
|
NeutrinoAPI->Lock();
|
||||||
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
||||||
NeutrinoAPI->mutex.unlock();
|
NeutrinoAPI->Unlock();
|
||||||
if (event) {
|
if (event) {
|
||||||
if (!isExt) {
|
if (!isExt) {
|
||||||
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
|
||||||
|
@@ -136,6 +136,8 @@ CNeutrinoAPI::CNeutrinoAPI()
|
|||||||
EventServer->registerEvent2( NeutrinoMessages::EVT_HDMI_CEC_STANDBY, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
|
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_MUTE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
|
||||||
EventServer->registerEvent2( NeutrinoMessages::EVT_SET_VOLUME, 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;
|
delete Timerd;
|
||||||
if (EventServer)
|
if (EventServer)
|
||||||
delete EventServer;
|
delete EventServer;
|
||||||
|
|
||||||
|
delete pmutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
@@ -172,7 +176,7 @@ void CNeutrinoAPI::UpdateBouquets(void)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
void CNeutrinoAPI::ZapTo(const char * const target)
|
void CNeutrinoAPI::ZapTo(const char * const target)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
|
||||||
t_channel_id channel_id;
|
t_channel_id channel_id;
|
||||||
|
|
||||||
sscanf(target,
|
sscanf(target,
|
||||||
@@ -184,7 +188,7 @@ void CNeutrinoAPI::ZapTo(const char * const target)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
|
void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
|
||||||
if (channel_id == Zapit->getCurrentServiceID())
|
if (channel_id == Zapit->getCurrentServiceID())
|
||||||
{
|
{
|
||||||
//printf("Kanal ist aktuell\n");
|
//printf("Kanal ist aktuell\n");
|
||||||
@@ -198,7 +202,7 @@ void CNeutrinoAPI::ZapToChannelId(t_channel_id channel_id)
|
|||||||
|
|
||||||
void CNeutrinoAPI::ZapToSubService(const char * const target)
|
void CNeutrinoAPI::ZapToSubService(const char * const target)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
|
||||||
t_channel_id channel_id;
|
t_channel_id channel_id;
|
||||||
|
|
||||||
sscanf(target,
|
sscanf(target,
|
||||||
@@ -211,7 +215,7 @@ void CNeutrinoAPI::ZapToSubService(const char * const target)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_name)
|
t_channel_id CNeutrinoAPI::ChannelNameToChannelId(std::string search_channel_name)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
|
||||||
//FIXME depending on mode missing
|
//FIXME depending on mode missing
|
||||||
//int mode = Zapit->getMode();
|
//int mode = Zapit->getMode();
|
||||||
t_channel_id channel_id = (t_channel_id)-1;
|
t_channel_id channel_id = (t_channel_id)-1;
|
||||||
@@ -269,7 +273,7 @@ bool CNeutrinoAPI::GetStreamInfo(int bitInfo[10])
|
|||||||
|
|
||||||
bool CNeutrinoAPI::GetChannelEvents(void)
|
bool CNeutrinoAPI::GetChannelEvents(void)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
|
||||||
eList.clear();
|
eList.clear();
|
||||||
CEitManager::getInstance()->getChannelEvents(eList);
|
CEitManager::getInstance()->getChannelEvents(eList);
|
||||||
CChannelEventList::iterator eventIterator;
|
CChannelEventList::iterator eventIterator;
|
||||||
@@ -289,7 +293,7 @@ bool CNeutrinoAPI::GetChannelEvents(void)
|
|||||||
|
|
||||||
std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id)
|
std::string CNeutrinoAPI::GetServiceName(t_channel_id channel_id)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
|
||||||
return CServiceManager::getInstance()->GetServiceName(channel_id);
|
return CServiceManager::getInstance()->GetServiceName(channel_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -428,7 +432,7 @@ std::string CNeutrinoAPI::getVideoAspectRatioAsString(void)
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString)
|
int CNeutrinoAPI::setVideoAspectRatioAsString(std::string newRatioString)
|
||||||
{
|
{
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
|
||||||
int newRatioInt = -1;
|
int newRatioInt = -1;
|
||||||
for(int i=0;i<(int)sizeof(videoformat_names);i++)
|
for(int i=0;i<(int)sizeof(videoformat_names);i++)
|
||||||
if( videoformat_names[i] == newRatioString){
|
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:"};
|
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 };
|
int caids[] = { 0x600, 0x1700, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 };
|
||||||
|
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(mutex);
|
OpenThreads::ScopedPointerLock<OpenThreads::Mutex> lock(pmutex);
|
||||||
CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
|
CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel();
|
||||||
if(channel) {
|
if(channel) {
|
||||||
for (unsigned short i = 0; i < 11; i++) {
|
for (unsigned short i = 0; i < 11; i++) {
|
||||||
|
@@ -25,7 +25,7 @@ bool _initialize_iso639_map(void);
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
class CNeutrinoAPI
|
class CNeutrinoAPI
|
||||||
{
|
{
|
||||||
OpenThreads::Mutex mutex;
|
OpenThreads::Mutex *pmutex;
|
||||||
// Clientlibs
|
// Clientlibs
|
||||||
CSectionsdClient *Sectionsd;
|
CSectionsdClient *Sectionsd;
|
||||||
CZapitClient *Zapit;
|
CZapitClient *Zapit;
|
||||||
@@ -88,6 +88,8 @@ public:
|
|||||||
CChannelEventList eList;
|
CChannelEventList eList;
|
||||||
CNeutrinoYParser *NeutrinoYParser;
|
CNeutrinoYParser *NeutrinoYParser;
|
||||||
CControlAPI *ControlAPI;
|
CControlAPI *ControlAPI;
|
||||||
|
void Lock() { pmutex->lock(); }
|
||||||
|
void Unlock() { pmutex->unlock(); }
|
||||||
|
|
||||||
friend class CNeutrinoYParser; // Backreference
|
friend class CNeutrinoYParser; // Backreference
|
||||||
friend class CControlAPI;
|
friend class CControlAPI;
|
||||||
|
@@ -359,9 +359,9 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std:
|
|||||||
{
|
{
|
||||||
CZapitChannel * channel = channels[j];
|
CZapitChannel * channel = channels[j];
|
||||||
CChannelEvent *event;
|
CChannelEvent *event;
|
||||||
NeutrinoAPI->mutex.lock();
|
NeutrinoAPI->Lock();
|
||||||
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
event = NeutrinoAPI->ChannelListEvents[channel->getChannelID()];
|
||||||
NeutrinoAPI->mutex.unlock();
|
NeutrinoAPI->Unlock();
|
||||||
|
|
||||||
classname = (i++ & 1) ? 'a' : 'b';
|
classname = (i++ & 1) ? 'a' : 'b';
|
||||||
if (channel->getChannelID() == current_channel)
|
if (channel->getChannelID() == current_channel)
|
||||||
|
Reference in New Issue
Block a user