Project

General

Profile

Bug #2517 » skinflatplus_locking3.patch

nanohcv, 08/30/2017 05:34 PM

View differences:

Makefile
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
CXXFLAGS += -std=c++11
### Allow user defined options to overwrite defaults:
-include $(PLGCFG)
-- a/baserender.c
++ b/baserender.c
......
#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;
}
};
#include <future>
#endif
cFlatBaseRender::cFlatBaseRender(void) {
......
if( Config.TopBarRecordingShow ) {
// look for timers
#if VDRVERSNUM >= 20301
numRec = cRecCounter::Count();
auto recCounterFuture = std::async([&numRec](){
LOCK_TIMERS_READ;
for(const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti)) {
if( ti->HasFlags(tfRecording) ) numRec++;
}
});
recCounterFuture.get();
#else
for(cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti))
if( ti->HasFlags(tfRecording) ) numRec++;
-- a/displaymenu.c
++ b/displaymenu.c
......
#include <fstream>
#include <iostream>
#if VDRVERSNUM >= 20301
#include <future>
#endif
#ifndef VDRLOGO
#define VDRLOGO "vdrlogo_default"
#endif
......
if( Config.MenuRecordingView == 0 )
return false;
#if VDRVERSNUM >= 20301
LOCK_RECORDINGS_READ;
#endif
cString buffer;
cString RecName = GetRecordingName(Recording, Level, Total == 0).c_str();
......
LastRecFolder = RecFolder;
if( RecFolder != "" && LastItemRecordingLevel > 0 ) {
#if VDRVERSNUM >= 20301
LOCK_RECORDINGS_READ;
for(const cRecording *Rec = Recordings->First(); Rec; Rec = Recordings->Next(Rec)) {
#else
for(cRecording *Rec = Recordings.First(); Rec; Rec = Recordings.Next(Rec)) {
......
}
} else {
#if VDRVERSNUM >= 20301
LOCK_RECORDINGS_READ;
for(const cRecording *Rec = Recordings->First(); Rec; Rec = Recordings->Next(Rec)) {
#else
for(cRecording *Rec = Recordings.First(); Rec; Rec = Recordings.Next(Rec)) {
......
// lent from skinelchi
if( Config.RecordingAdditionalInfoShow ) {
#if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ;
const cChannel *channel = Channels->GetByChannelID(((cRecordingInfo *)recInfo)->ChannelID());
auto channelFuture = std::async([&recAdditional](tChannelID channelId){
LOCK_CHANNELS_READ;
const cChannel *channel = Channels->GetByChannelID(channelId);
if (channel)
recAdditional << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << endl;
}, recInfo->ChannelID());
channelFuture.get();
#else
cChannel *channel = Channels.GetByChannelID(((cRecordingInfo *)recInfo)->ChannelID());
#endif
if (channel)
recAdditional << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << endl;
recAdditional << trVDR("Channel") << ": " << channel->Number() << " - " << channel->Name() << endl;
#endif
const cEvent *Event = recInfo->GetEvent();
if( Event ) {
(6-6/6)