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?
Solved! Go to Solution.
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?
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
I think that the reason for this lies in the Do.vi. Reentrance is namely set to "shared clone reentrant".
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.
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
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?
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.
Hi , did u test the program i have uploaded?
i think it shouldn't work like that,or the message is not needed
GIT rock 😁
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.
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.