|
VLink
2.0.0
A high-performance communication middleware
|
Plugin contract for self-driving plugins that own a private MessageLoop thread.
更多...
类 | |
| class | vlink::RunablePluginInterface |
Abstract plugin base that already owns a MessageLoop event thread. 更多... | |
命名空间 | |
| vlink | |
Plugin contract for self-driving plugins that own a private MessageLoop thread.
RunablePluginInterface (the spelling is intentional and preserved for backwards compatibility) blends MessageLoop with the VLink Plugin framework so a dynamic plugin can carry its own event loop and dispatch timers, subscribers and other asynchronous primitives without depending on the host's loop.
Plugin contract:
| Hook | When the host calls it | Mandatory action |
|---|---|---|
| constructor | At Plugin::load time | Cheap construction; no thread-local work yet |
async_run() | After load, on the host's thread | Inherited from MessageLoop; starts the loop |
on_init() | Right after async_run() succeeds | Set up subscribers, timers and other live resources |
on_deinit() | Just before unload | Tear down everything created in on_init() |
| destructor | When the Plugin handle is released | Final cleanup; loop has already been stopped |
Plugin lifecycle:
* Plugin::load(...) * | * v * constructor --> async_run() --> on_init() * | * v * plugin work (loop running) * | * v * on_deinit() * | * v * stop loop / unload *