diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2002-05-12 10:20:17 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2002-05-12 10:20:17 +0200 |
commit | 5d733e59ee0b0de00cf4967287ef7f431828726a (patch) | |
tree | 79e51986521582cc10f8a6cf0ae0dd05153cc96f /plugin.c | |
parent | 01c68def34bc8b1d2a2b5ac0a21c6eb4a13e04e3 (diff) | |
download | vdr-5d733e59ee0b0de00cf4967287ef7f431828726a.tar.gz vdr-5d733e59ee0b0de00cf4967287ef7f431828726a.tar.bz2 |
Added the cPlugin::Housekeeping() function
Diffstat (limited to 'plugin.c')
-rw-r--r-- | plugin.c | 28 |
1 files changed, 26 insertions, 2 deletions
@@ -4,19 +4,21 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: plugin.c 1.2 2002/05/12 09:04:51 kls Exp $ + * $Id: plugin.c 1.3 2002/05/12 10:10:38 kls Exp $ */ #include "plugin.h" #include <ctype.h> #include <dirent.h> #include <dlfcn.h> +#include <time.h> #include "config.h" #define LIBVDR_PREFIX "libvdr-" #define SO_INDICATOR ".so." #define MAXPLUGINARGS 1024 +#define HOUSEKEEPINGDELTA 10 // seconds // --- cPlugin --------------------------------------------------------------- @@ -50,6 +52,10 @@ bool cPlugin::Start(void) return true; } +void cPlugin::Housekeeping(void) +{ +} + const char *cPlugin::MainMenuEntry(void) { return NULL; @@ -202,6 +208,8 @@ cPluginManager *cPluginManager::pluginManager = NULL; cPluginManager::cPluginManager(const char *Directory) { directory = NULL; + lastHousekeeping = time(NULL); + nextHousekeeping = -1; if (pluginManager) { fprintf(stderr, "vdr: attempt to create more than one plugin manager - exiting!\n"); exit(2); @@ -278,13 +286,29 @@ bool cPluginManager::StartPlugins(void) Setup.OSDLanguage = 0; // the i18n texts are only available _after_ Start() isyslog(LOG_INFO, "starting plugin: %s (%s): %s", p->Name(), p->Version(), p->Description()); Setup.OSDLanguage = Language; - if (!dll->Plugin()->Start()) + if (!p->Start()) return false; } } return true; } +void cPluginManager::Housekeeping(void) +{ + if (time(NULL) - lastHousekeeping > HOUSEKEEPINGDELTA) { + if (++nextHousekeeping >= dlls.Count()) + nextHousekeeping = 0; + cDll *dll = dlls.Get(nextHousekeeping); + if (dll) { + cPlugin *p = dll->Plugin(); + if (p) { + p->Housekeeping(); + } + } + lastHousekeeping = time(NULL); + } +} + bool cPluginManager::HasPlugins(void) { return pluginManager && pluginManager->dlls.Count(); |