Re: Plugin Unloading



On Wed, 2003-09-24 at 21:32, Bob Smith wrote:
> Another question for the design doc.
> 
> The current design seems to be based around a plugin offering up
> services to be consumed. The application is then in charge of consuming
> a service. The question is, how do we handle the user going into a GUI
> and telling the app to unload the foo plugin? It can't be unloaded
> until the application stops using it. Should we have an event of sorts
> on a plugin class / service class to say, this plugin is unloading,
> expect it to go away? That sounds like it could be a lot of work for
> the programmer using the plugin system.

That'd be a nightmare.  I'm expecting more of a reference-counting
system.  I'd expect the service class to ref/unref the plugin as service
objects are instantiated/destroyed.  You could also have an instance
count in the service class, so that each service can track how many
objects are around.

Getting more complicated, can you have dependencies between plugins or
services e.g a plugin which uses functionality from another plugin?

> 
> We could use refcounting and say, the plugin is unloadable only when
> refcount is 0. But then the app can't hold on to a service when its not
> being used. For my app, this wouldn't work well at all. It could work
> for my app if I forced the use of ghost services so maybe it is ok.
> 
Can't you just hold a dummy reference to stop the thing being unloaded? 
When the user requests an unload, you release that reference.  Then the
plugin gets actually unloaded when all the service objects go away.


> Thoughts/Comments?
> 
> ---  Bob Smith <bob thestuff net>  ---
> ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++
> ..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
-- 
David Malcolm
www.conglomerate.org




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]