From ab8c11e9983c5d80fcc2c30abd953fa29f606589 Mon Sep 17 00:00:00 2001 From: Martin Schirrmacher Date: Sat, 9 Sep 2017 15:54:18 +0200 Subject: add patch for locking from nanohcv; fix SetItemEvent for older vdr versions --- baserender.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'baserender.c') diff --git a/baserender.c b/baserender.c index 785202eb..1e8dc316 100644 --- a/baserender.c +++ b/baserender.c @@ -10,31 +10,7 @@ #include FT_FREETYPE_H #if VDRVERSNUM >= 20301 -#include - -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 #endif cFlatBaseRender::cFlatBaseRender(void) { @@ -452,7 +428,13 @@ void cFlatBaseRender::TopBarUpdate(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++; -- cgit v1.2.3