05-29-2018 09:07 AM
Can one DQMH module register for other module's broadcast event if the module registering did not launch this other module. In other words if I have 2 DQMH modules, let's say launched by some other means... even manually... let's say... can these 2 modules register for and receive each other's broadcasts, by simply instantiating each other's "Obtain Broadcast Events for Registration.vi". Something tells me the answer is no, and does it have anything to do with whatever the "Synchronize Module Events.vi" does? Thank you.
Solved! Go to Solution.
05-29-2018 09:18 AM
Hi Rafal_Kor,
Short answer:
Unlike Actor Framework, any VI with an event structure can register to the broadcasts of any DQMH module regardless if they were involved in the launching of those modules or not.
Long answer:
Obtain Broadcast Events for Registration.vi wraps a functional global variable with the broadcast event references. These references are only created by the DQMH module when it starts. If the module has not started yet, the output of this VI is null references. So in order for an event structure to be able to register for the events of a DQMH module, the DQMH module needs to be already running.
Alternatively, the Start Module.vi does return the broadcast events for registration and, in the case of singletons, can be called from as many places as you wish and it will always connect to the same singleton instance.
The Synchronize Module Events.vi is there to ensure that the Module has completed initialization before we send it requests and that the calling code has registered for broadcasts before the module starts broadcasting events. I suggest you open the Start Module.vi, the Obtain Broadcast Events for Registration.vi and the Synchronize Module Events.vi. We have placed several free labels describing what the code is doing, also check the VI documentation. Please let us know if we can improve this documentation in any way.
Regards,
Fab
05-29-2018 09:33 AM
DQMH works like a charm. Thanks for your quick response, and of course now, on second thought, I think I remember thinking to myself, not to forget to launch the one module first before any other module trying to listen in to the first module's broadcasts, but then the long weekend happened, and I forgot. Thank for helping so quickly. Delacor is awesome!