11-18-2020 07:28 PM - edited 11-18-2020 08:02 PM
Hi all,i got a problem which is not found in the discunssions before,so pls give me a tip :
The message is in a loop ,read client 's request .
I built a actor , launch two times to do the same thing but face to different client , just like a framework ;
Launch one time works well , but two times works bad .
I debug the vis , found the message B(right) call the Method C (left) , not call the Method C (right) . I have already made the Method C reentrant.
Did i do something wrong?
THKS!
Solved! Go to Solution.
11-19-2020 05:11 AM
How do you distinguish between the "right" and the "wrong" method C? Are you sure that you are sending the Msg to the correct enqueer?
11-19-2020 08:08 PM - edited 11-20-2020 03:32 AM
Thank you for reply.
I used the "LabVIEW Task Manager" , open the method C (left and right in the picture ) .
The left method C got the requests from client , but the right method C got request sometimes , most request were sent to the left method C 。
I upload an example which was published by NI
run the "Simple Actor Example.vi" , click the new 3 or more times , then open the "LabVIEW Task Manager" , like the picture below:
then open three vis(7340002,7340003,7340004),and add probe on "Gauge Refnum" ,then you will find the value of refnum handle is not a constant, it's floating.
I think the the value of reference handle should not be changed , if changed then you can't do the right thing to the right refnum, am i right ? THKS
11-20-2020 02:42 AM
I think that the reason for this lies in the Do.vi. Reentrance is namely set to "shared clone reentrant".
https://zone.ni.com/reference/en-XX/help/371361R-01/lvconcepts/reentrancy/
If you would set Do.vi to "preallocated clone", the behavior would be as you expect. But I do not recommend this, because this would mean changing the Message.lvclass::Do.vi and thus the behaviour of the whole AF.
11-20-2020 03:30 AM
yes,and if i set Do.vi to "preallocated clone" , the Do.vi is broken , it change the whole AF ,
so i have no idea
11-20-2020 03:51 AM
Sorry, changing the reentrance type was a bad suggestion. Of course this is not possible because of dynamic dispatch terminals.
But, at what specific problem does LV's behavior bother you?
P.S.
A good idea is to save the original state of AF.lvlib before making global changes. I prefer to create a GIT repository in AF folder and to make the first commit before changing something.
11-20-2020 04:21 AM
Hi , did u test the program i have uploaded?
i think it shouldn't work like that,or the message is not needed
thks.
P.S.
GIT rock 😁
11-20-2020 04:47 AM
Yes I did.
The behavior must be like this. Even if it is not intuitive. I don't understand which specific problem You have? Of course in this case You cannot use shift registers to store state between VI calls. Save the state in the member variables of your actor. Then it doesn't matter which clone of method C is called.
11-23-2020 10:35 PM
if the message reply is wrong ,the next step is also wrong
11-24-2020 10:07 AM
There is no way to force a specific instance of a clone to execute in a particular actors message. Why do you need this behavior? There are some real use cases of this, but there is a good chance you don't actually need this - can you not just store the relevant state data in the actor's class data?
If you actually need this behavior, you can add a helper loop to actor core, and then make your method C a preallocated clone and call it from there. Of course you will need to add some communication mechanism from the actor message handling loop to this secondary loop - you could have your method C message just pass another message to the helper loop. Depending on what is happening in the helper loop, this can get pretty messy pretty quickly, which is why it is better to just do it in the actor's message handling loop if possible.