diff --git a/HISTORY b/HISTORY index 2b3ceffd..06696427 100644 --- a/HISTORY +++ b/HISTORY @@ -10079,3 +10079,5 @@ Video Disk Recorder Revision History work as before, because the default implementation of cStatus::OsdStatusMessage2() calls cStatus::OsdStatusMessage(). - Adjusted PLUGINS.html to the new API version numbering introduced in version 2.7.2. +- The function cPlugin::MainThreadHook() has been deprecated and may be removed in future + versions. Use proper locking instead. diff --git a/PLUGINS.html b/PLUGINS.html index ae11a165..ac6c7b7f 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -74,7 +74,6 @@ structures and allows it to hook itself into specific areas to perform special a
  • Main menu entry
  • User interaction
  • Housekeeping -
  • Main thread hook
  • Activity
  • Wakeup
  • Setup parameters @@ -692,27 +691,6 @@ interaction is possible. If a specific action takes longer than a few seconds, the plugin should launch a separate thread to do this. -

    Main thread hook

    - -
    Pushing in...

    - -Normally a plugin only reacts on user input if directly called through its -main menu entry, or performs some background -activity in a separate thread. However, sometimes a plugin may need to do -something in the context of the main program thread, without being explicitly -called up by the user. In such a case it can implement the function - -

    -virtual void MainThreadHook(void);
    -

    - -in which it can do this. This function is called for every plugin once during -every cycle of VDR's main program loop, which typically happens once every -second. -Be very careful when using this function, and make sure you return from it -as soon as possible! If you spend too much time in this function, the user -interface performance will become sluggish! -


    Activity

    Now is not a good time!

    diff --git a/newplugin b/newplugin index 4a7d68b7..2ed7c4d1 100755 --- a/newplugin +++ b/newplugin @@ -12,7 +12,7 @@ # See the main source file 'vdr.c' for copyright information and # how to reach the author. # -# $Id: newplugin 5.1 2021/01/02 14:32:20 kls Exp $ +# $Id: newplugin 5.2 2025/02/12 22:22:20 kls Exp $ $PLUGIN_NAME = $ARGV[0] || die "Usage: newplugin \n"; @@ -216,7 +216,6 @@ public: virtual bool Start(void); virtual void Stop(void); virtual void Housekeeping(void); - virtual void MainThreadHook(void); virtual cString Active(void); virtual time_t WakeupTime(void); virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; } @@ -274,12 +273,6 @@ void cPlugin${PLUGIN_CLASS}::Housekeeping(void) // Perform any cleanup or other regular tasks. } -void cPlugin${PLUGIN_CLASS}::MainThreadHook(void) -{ - // Perform actions in the context of the main program thread. - // WARNING: Use with great care - see PLUGINS.html! -} - cString cPlugin${PLUGIN_CLASS}::Active(void) { // Return a message string if shutdown should be postponed diff --git a/plugin.c b/plugin.c index 7c0d55c8..efe8651d 100644 --- a/plugin.c +++ b/plugin.c @@ -4,9 +4,10 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: plugin.c 4.4 2020/12/16 11:54:06 kls Exp $ + * $Id: plugin.c 5.1 2025/02/12 22:22:20 kls Exp $ */ +#define MUTE_DEPRECATED_MAINTHREADHOOK #include "plugin.h" #include #include diff --git a/plugin.h b/plugin.h index 64632c55..a419f3f2 100644 --- a/plugin.h +++ b/plugin.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: plugin.h 4.1 2020/06/29 09:29:06 kls Exp $ + * $Id: plugin.h 5.1 2025/02/12 22:22:20 kls Exp $ */ #ifndef __PLUGIN_H @@ -43,6 +43,9 @@ public: virtual bool Start(void); virtual void Stop(void); virtual void Housekeeping(void); +#ifndef MUTE_DEPRECATED_MAINTHREADHOOK + [[deprecated("use proper locking instead")]] +#endif virtual void MainThreadHook(void); virtual cString Active(void); virtual time_t WakeupTime(void);