summaryrefslogtreecommitdiff
path: root/baserender.c
diff options
context:
space:
mode:
authorMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2017-08-27 15:35:21 +0200
committerMartin Schirrmacher <vdr.skinflatplus@schirrmacher.eu>2017-08-27 15:35:21 +0200
commit9ee7adcd4cd026e6b9074b4760b6d62ed4b2fbb4 (patch)
tree861ae13dae8ed7a12016f21964539a5e13733f9d /baserender.c
parentb4b62d764e6e1a75329c3fb4864a1f082503740b (diff)
downloadskin-flatplus-9ee7adcd4cd026e6b9074b4760b6d62ed4b2fbb4.tar.gz
skin-flatplus-9ee7adcd4cd026e6b9074b4760b6d62ed4b2fbb4.tar.bz2
fix invalid locking
Diffstat (limited to 'baserender.c')
-rw-r--r--baserender.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/baserender.c b/baserender.c
index 17e2acec..785202eb 100644
--- a/baserender.c
+++ b/baserender.c
@@ -9,6 +9,34 @@
#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);
@@ -424,15 +452,11 @@ void cFlatBaseRender::TopBarUpdate(void) {
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 ) {