Jump to content

Actor framework: User Event Error 1


Recommended Posts

Posted

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

Posted

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.

 

Posted
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.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.