The function cPlugin::MainThreadHook() has been deprecated

This commit is contained in:
Klaus Schmidinger 2025-02-12 22:22:20 +01:00
parent 34aa8fe8b4
commit 1b4233d6ad
5 changed files with 9 additions and 32 deletions

View File

@ -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.

View File

@ -74,7 +74,6 @@ structures and allows it to hook itself into specific areas to perform special a
<li><a href="#Main menu entry">Main menu entry</a>
<li><a href="#User interaction">User interaction</a>
<li><a href="#Housekeeping">Housekeeping</a>
<li><a href="#Main thread hook">Main thread hook</a>
<li><a href="#Activity">Activity</a>
<li><a href="#Wakeup">Wakeup</a>
<li><a href="#Setup parameters">Setup parameters</a>
@ -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.
</b>
<hr><h2><a name="Main thread hook">Main thread hook</a></h2>
<div class="blurb">Pushing in...</div><p>
Normally a plugin only reacts on user input if directly called through its
<a href="#Main menu entry">main menu entry</a>, 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
<p><table><tr><td class="code"><pre>
virtual void MainThreadHook(void);
</pre></td></tr></table><p>
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.
<b>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!</b>
<hr><h2><a name="Activity">Activity</a></h2>
<div class="blurb">Now is not a good time!</div><p>

View File

@ -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 <name>\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

View File

@ -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 <ctype.h>
#include <dirent.h>

View File

@ -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);