04-20-2023 07:18 AM
Hi everybody,
i have one question regarding launching nested actors.
There is two situations.
On first picture, nested actors are launched, and everything works just fine.
When i close root actor(program manager), all actors are closed, and in project explorer there is no locks.
In second situation, actor are launched, but after closing root actor, all actor remains locked.
And, i see that in some project that i saw, this situation also works just fine.
Can someone explain me why this doesn't work in my case?
Thanks
Solved! Go to Solution.
04-20-2023 09:16 AM
Do you know how your nested actors are stopped in the first case? By default, nested actors are launched with auto-stop enabled. Launch Nested Actor records the enqueuer and Stop Core sends a stop message to those actors.
In the second case that mechanism cannot work. Since LabVIEW classes are by value, you create three copies of your actor, store an enqueuer in each of them and then throw the copies away. That could work if you also stored the enqueuer of the device actor in the launching actor's private data. You would then have to send a stop message to each of the nested actors. I assume that is what happens in the other project you saw. It is still bad form and inefficient to do it that way.
04-20-2023 03:44 PM
Thanks for feedback.
Can you suggest what would be good practice?
What you recommend, how to launch nested actors in proper way?
I understand that these are basic staff, but i'm new in actor, so any help is welcome.
Thanks
04-20-2023 05:47 PM
@milan87 wrote:
Hi everybody,
i have one question regarding launching nested actors.
There is two situations.
On first picture, nested actors are launched, and everything works just fine.
When i close root actor(program manager), all actors are closed, and in project explorer there is no locks.
In second situation, actor are launched, but after closing root actor, all actor remains locked.
And, i see that in some project that i saw, this situation also works just fine.
Can someone explain me why this doesn't work in my case?
Thanks
The difference between the two cases is that in the first one, the 'send actor stop' command is handled by the parent actor since it 'knows' about the child actors. This is because of data flow. You pass the ref in sequence to launch each actor one after another so the parent is aware of the child, and can sed the stop actor message.
In the second case, there is no 'data flow' as mentioned previously. You just make three copies of the actor and they do not know how to know which is the parent and which is the child since they are not connected in a horizontal data flow paradigm.
One thing to note is that you can make the second case work just fine but you have to do more work. You need to make an event case that triggers when you stop the program then use the enqueuer for each 'child' actor to explicitly send the 'stop actor' message. So you will also need to store the third actors enqueuer as you have stored the first two.
04-21-2023 04:11 AM - edited 04-21-2023 04:40 AM
You mean like this.
Thanks a lot for both replays.It works fine.
04-21-2023 04:31 AM
I mostly reacted to you not collecting the Device ref, but then i've never used Actor Framework. 🙂
04-21-2023 08:30 AM
@milan87 wrote:
You mean like this.
Thanks a lot for both replays.It works fine.
Yes, like that.