|
C-Pluff C API 0.2.0
|
These functions support a plug-in controlled execution model.
These functions support a plug-in controlled execution model.
Started plug-ins can use cp_run_function to register a run function which is called when the main program calls cp_run_plugins or cp_run_plugins_step. A run function should do a finite chunk of work and then return telling whether there is more work to be done. A run function is automatically unregistered when the plug-in is stopped. Run functions make it possible for plug-ins to control the flow of execution or they can be used as a coarse way of task switching if there is no multi-threading support.
The C-Pluff distribution includes a generic main program, cpluff-loader, which only acts as a plug-in loader. It loads and starts up the specified plug-ins, passing any additional startup arguments to them and then just calls run functions of the plug-ins. This makes it is possible to put all the application specific logic in plug-ins. Application does not necessarily need a main program of its own.
It is also safe, from framework perspective, to call these functions from multiple threads. Run functions may then be executed in parallel threads.