[2nd send, the first one didn't showed up]

I'm in the process of writing a "Hello-World" plugin (which already works 
great! [well, if it wasn't, I'd be a very bad coder, heh?]) as a proof of 
concept to extend the current plugin mechanism (and before the Bochs plugin 
gets fragmented) and to write some sample for whoever wants to write 
plugins. Heavily commented, you can be sure :-)

One of the thing I came across is the lack of support for many instances of 
a single plugin. This requires at least a way to specify which instance we 
are talking to, when we query or even terminate the instance (plugin_fini). 
This is not a problem with IO/Int events, though, as the plugin can easily 
figure it out itself.

I figured out two solutions. Pointers to the plugin can be passed to each 
concerned function, à la C++ "this" pointer, or use a Lock/Unlock mechanism 
with mutexes to fix the plugin's internal "current instance" pointer, and 
then call the functions.

It is to be noted that performance is not critical, as these won't be 
called often. Anything that calls these function a lot is to be considered 
a bad design.
Most of the times, a batch of the plugin's functions will be called in a 
few lines of code (especialy query functions).
Many instances of a plugin, or Plex86 itself could be ran.
I however always fear deadlocks using mutexes, but this being open 
software, it will be easily spotted out if it ever happen.

I'm obviously in favor of the Lock/Unlock mechanism, but I want to hear 
some opinions.

EL 


Reply via email to