LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Launcing nested actors - Actor framework

Solved!
Go to solution

Hi everybody,

 

i have one question regarding launching nested actors.

There is two situations.

1.JPG

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.

2.JPG

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

 

0 Kudos
Message 1 of 7
(1,771 Views)

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.

0 Kudos
Message 2 of 7
(1,753 Views)

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

0 Kudos
Message 3 of 7
(1,733 Views)
Solution
Accepted by topic author milan87

@milan87 wrote:

Hi everybody,

 

i have one question regarding launching nested actors.

There is two situations.

1.JPG

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.

2.JPG

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. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
Message 4 of 7
(1,725 Views)

You mean like this.

milan87_0-1682070004345.png

 

Thanks a lot for both replays.It works fine.

0 Kudos
Message 5 of 7
(1,709 Views)

I mostly reacted to you not collecting the Device ref, but then i've never used Actor Framework. 🙂

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(1,705 Views)

@milan87 wrote:

You mean like this.

milan87_0-1682070004345.png

 

Thanks a lot for both replays.It works fine.


Yes, like that. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 7 of 7
(1,685 Views)