xabi Posted April 15 Report Posted April 15 I’m working on a project using the Actor Framework to remotely control an oscilloscope. The actor responsible for the oscilloscope overrides the Actor Core to run a loop that acquires data, which is then sent to the root actor for processing. The issue is that when stopping the root actor, the oscilloscope actor throws an error when trying to send the data (which is expected, since the root actor no longer exists). However, the problem is that when executing Stop Core—where the acquisition and UI loops are stopped—for some reason error 1 is generated and the actor does not shut down properly. On the other hand, when sending the Stop message, it does stop correctly. Any ideas? Thanks in advance! Generic Oscilloscope.zip Quote
xabi Posted April 15 Author Report Posted April 15 (edited) Edit: No, I't doesn't works Edited April 15 by xabi Fails again Quote
xabi Posted April 16 Author Report Posted April 16 It seems this is related to the execution level of the constructor. Since the constructor was executed in the scope of the VI I use for testing, once that VI finishes and stops, LabVIEW may unregister the reference before the actor stops. LabVIEW reference about user event registration: Quote Registered events stay registered until you explicitly unregister them or until the VI that registered the events finishes running or you abort the VI. If the VI which registered for events was a subVI, events are unregistered when that VI's top-level VI finishes execution or is aborted. If you use the Run VI method to execute a subVI that registered for events, events are unregistered when the subVI finishes execution or is aborted. Quote
Rolf Kalbermatter Posted April 16 Report Posted April 16 2 hours ago, xabi said: It seems this is related to the execution level of the constructor. Since the constructor was executed in the scope of the VI I use for testing, once that VI finishes and stops, LabVIEW may unregister the reference before the actor stops. LabVIEW reference about user event registration: It is not that LabVIEW MAY unregister the reference, but that it WILL unregister the reference as soon as the top level VI in whose hierarchy the reference was created goes idle. This is by design and the only way to prevent that is to either keep that hierarchy active until any other user of that refnum has finished or delegate creating of the refnum to the place where it is needed, for instance through a LV2 style global maintaining the reference in a shift register and when being called for the first time it will create the refnum if the shift register contains an invalid refnum. True Actor Framework design kind of mandates that all refnums are created in the context of where they are used not some other global instance that may or may not keep running for the time some Actor is using the refnum. 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.