03-16-2023 04:07 AM
Hi,
I'm wondering why the VI below outputs different semaphore references. So far I assumed that they will be the same.
Thanks!
Solved! Go to Solution.
03-16-2023 04:13 AM
Hi 1984,
@1984 wrote:
So far I assumed that they will be the same.
Why did you?
You create a bunch of semaphores: each will be a new one with its own reference. But they may point to the same (LabVIEW internal) control structure…
03-16-2023 04:17 AM
You get different references to the same object.
Internally, semaphores are just queues.
This will also return false.
Different reference to the same object.
However, if you somehow get two references to a GObject (controls, nodes, wires, etc.) a compare of a different reference to the same object will return true...
So it doesn't seem wrong, but it is a bit inconsistent.
03-16-2023 04:20 AM
@GerdW wrote:
Hi 1984,
@1984 wrote:
So far I assumed that they will be the same.
Why did you?
You create a bunch of semaphores: each will be a new one with its own reference. But they may point to the same (LabVIEW internal) control structure…
But they are not new semaphores. The created new output is false.
So, new references to the same object.
Comparing other references does return true if the reference is different, but pointing to the same object.
03-16-2023 04:31 AM - edited 03-16-2023 04:35 AM
Because I'm certainly not as clever as some other people and I often make false assumptions.
I thought that with whatever internal mechanism once a semaphore reference is created then if we'd like to create it again it will return the same reference. I'm clearly wrong as the VI above demonstrates, I was just surprized and wondering about the reason.
What do you mean on "but they may point to the same (LabVIEW internal) control structure". Is it possible that they are not?
Thx.