I do the same, my logic is I add all my child enqueuers in the parent's private data. In handle last ack core.vi, I initialise the child count as 5 , keep reducing it as the child stops, once the count is 0, i send stop msg to parent. This works fine when I give break points in the case where child's last ack is received, but if I remove the breakpoints, My project gets into lock mode. I don't understand why that happens. I have attached the snapshots of cases of my logic below.
How to store the enqueuers in a array in private data? I tried by creating a data member access VI for a Array constant in Private data, and the using Write vi of data member access, I transferred the data of enqueuers. But when I unbundled the private data in Handle Ack core, I am getting only empty array. Can someone please help me resolve this issue?!
I am posting the project which I did just to try out this feature. "Generate" is the parent that launches "Display and Child 2". I have used Data Member Access VI to write the Enqueuers in Array format to the parent's private data.
The issue is I am getting empty array when I unbundle the private data of the parent in its Handle Last Ack core.vi. Can someone help to solve this...
You should never fork your actor somewhere else your parent actor core.vi.
The thing is you handle your "real actor" in actor core, where is executed Handle last Ack, and a kind of copied "dead actor" in your event loop where you store your references. These two objects are not the same! So the arrays are different. One is empty for ever, the other is filled. The breakpoint must not change anything to me.
To solve your problem, embed ALL your methods managing your actor into class VIs called by message from your event loop. The cool thing is that you won't have to create a data member access, just bundle/unbundle your nesteds array. The bad thing is it adds complexity and messages. But it's the only way.
I have changed the actor tunnels with shift register and linked input tunnels, I'm getting the array of enqueuers when i check in the actor core vi, but still not getting in handle last ack core. I have attached the screenshot of the changes I made.
Sorry, I think I was not clear at all...
Look at the code below:
Do you think the "Nested queues" indicator in the while loop will ever display a non-empty array? Obviously no. Because the cluster is forked at the beginning and 2 copies are then used, one in the sequence where the array is added with a new element, and one in the while loop where nothing happen to the array.
The situation is exactly the same for you. Replace the cluster by the actor object, the sequence by your event loop, and my while loop by the parent actore core.
Anyway, again the solution is to:
- Never insert your actor in the event loop!
- Instead, insert its self enqueuer
- Create a method for the actor called "Launch nested actor" or whatever, and put inside the exact code you have in your event "Launch Nested actor".
- Create a message on this method
- Send the message from your event using the self enqueuer your previously added
Thus, your nested enqueuers are handled in the same object, and your Handle last ack should work properly 😉
I get my enqueuers in Handle Last ack core now, But incase of error, I handle it in parent's Handle Error.vi override, where I get the pop of my error but My parent actor gets stopped as soon as I click ok in the pop up. Is there any other way that I can give any other logic instead of my parent getting stopped. I tried to change the constant to false inside the handle error subvi, still thats not working....