LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Different Semaphore references for the same semaphore?

Solved!
Go to solution

Hi,

 

I'm wondering why the VI below outputs different semaphore references. So far I assumed that they will be the same.

 

Thanks!

 

Semaphore references.png

 

1984_0-1678957613315.png

 

0 Kudos
Message 1 of 11
(1,380 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(1,374 Views)

You get different references to the same object.

 

Internally, semaphores are just queues.

 

wiebeCARYA_0-1678958109288.png

 

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.

0 Kudos
Message 3 of 11
(1,366 Views)

@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.

0 Kudos
Message 4 of 11
(1,364 Views)

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.

0 Kudos
Message 5 of 11
(1,357 Views)
Solution
Accepted by topic author 1984