From 0873d146141bb86a24f2e9806b73362f49bc7d52 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 29 May 2019 16:44:55 +0200 Subject: [PATCH] If cSkins::Message() is called from a background thread and Type is not mtStatus, the call is now automatically forwarded to QueueMessage() --- HISTORY | 2 ++ skins.c | 7 +++++-- skins.h | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index c91c8dcc..f0010f55 100644 --- a/HISTORY +++ b/HISTORY @@ -9415,3 +9415,5 @@ Video Disk Recorder Revision History - Fixed inconsistent behavior in case only certain devices are used (selected by the '-D' option). - Fixed a wrong variable name in cFileName::cFileName(). +- If cSkins::Message() is called from a background thread and Type is not mtStatus, + the call is now automatically forwarded to QueueMessage(). diff --git a/skins.c b/skins.c index b5c447b0..47b330e2 100644 --- a/skins.c +++ b/skins.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.c 4.1 2018/04/28 12:13:01 kls Exp $ + * $Id: skins.c 4.2 2019/05/29 16:43:09 kls Exp $ */ #include "skins.h" @@ -250,7 +250,10 @@ bool cSkins::SetCurrent(const char *Name) eKeys cSkins::Message(eMessageType Type, const char *s, int Seconds) { if (!cThread::IsMainThread()) { - dsyslog("cSkins::Message() called from background thread - ignored! (Use cSkins::QueueMessage() instead)"); + if (Type != mtStatus) + QueueMessage(Type, s, Seconds); + else + dsyslog("cSkins::Message(%d, \"%s\", %d) called from background thread - ignored! (Use cSkins::QueueMessage() instead)", Type, s, Seconds); return kNone; } switch (Type) { diff --git a/skins.h b/skins.h index bd8e15d1..ef27e825 100644 --- a/skins.h +++ b/skins.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.h 4.5 2017/11/02 15:04:56 kls Exp $ + * $Id: skins.h 4.6 2019/05/29 16:36:41 kls Exp $ */ #ifndef __SKINS_H @@ -477,6 +477,8 @@ public: ///< has been received within Seconds (the default value of 0 results ///< in the value defined for "Message time" in the setup), kNone ///< will be returned. + ///< If Message() is called from a background thread and Type is not + ///< mtStatus, the call will be automatically forwarded to QueueMessage(). int QueueMessage(eMessageType Type, const char *s, int Seconds = 0, int Timeout = 0); ///< Like Message(), but this function may be called from a background ///< thread. The given message is put into a queue and the main program