Project

General

Profile

Bug #2517 » skinflatplus_locking.patch

nanohcv, 08/12/2017 12:18 PM

View differences:

baserender.c
#include <ft2build.h>
#include FT_FREETYPE_H
#if VDRVERSNUM >= 20301
#include <vdr/thread.h>
class cRecCounter : public cThread
{
private:
int numRec;
cCondWait condWait;
cRecCounter() { numRec = 0; }
protected:
void Action(void) {
LOCK_TIMERS_READ;
for(const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti)) {
if( ti->HasFlags(tfRecording) ) numRec++;
}
condWait.Signal();
}
public:
static int Count(void) {
cRecCounter rc;
rc.Start();
if(rc.condWait.Wait(500))
return rc.numRec;
return 0;
}
};
#endif
cFlatBaseRender::cFlatBaseRender(void) {
font = cFont::CreateFont(Setup.FontOsd, Setup.FontOsdSize );
fontSml = cFont::CreateFont(Setup.FontSml, Setup.FontSmlSize);
......
if( Config.TopBarRecordingShow ) {
// look for timers
#if VDRVERSNUM >= 20301
LOCK_TIMERS_READ;
for(const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti)) {
numRec = cRecCounter::Count();
#else
for(cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti)) {
for(cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti))
if( ti->HasFlags(tfRecording) ) numRec++;
#endif
if( ti->HasFlags(tfRecording) ) {
numRec++;
}
}
if( numRec ) {
imgRec = imgLoader.LoadIcon("topbar_timer", topBarFontHeight - marginItem*2, topBarFontHeight - marginItem*2);
if( imgRec ) {
-- a/displaymenu.c
++ b/displaymenu.c
......
//check if remotetimers plugin is available
static cPlugin* pRemoteTimers = cPluginManager::GetPlugin("remotetimers");
#if VDRVERSNUM >= 20301
LOCK_SCHEDULES_READ;
#else
cSchedulesLock SchedulesLock;
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
#endif
time_t now;
time(&now);
if( (Config.MainMenuWidgetActiveTimerShowRemoteActive || Config.MainMenuWidgetActiveTimerShowRemoteRecording) && pRemoteTimers && (now - remoteTimersLastRefresh) > Config.MainMenuWidgetActiveTimerShowRemoteRefreshTime ) {
......
if( timerRec.Size() + timerActive.Size() >= Config.MainMenuWidgetActiveTimerMaxCount )
break;
}
#if VDRVERSNUM >= 20301
LOCK_SCHEDULES_READ;
#else
cSchedulesLock SchedulesLock;
const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock);
#endif
if( (Config.MainMenuWidgetActiveTimerShowRemoteActive || Config.MainMenuWidgetActiveTimerShowRemoteRecording) && pRemoteTimers &&
timerRec.Size() + timerActive.Size() < Config.MainMenuWidgetActiveTimerMaxCount ) {
cTimer* remoteTimer = NULL;
(3-3/6)