LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Global variable mutex when more than one front panel object in VI

Hi GerdW,

 

I understand your points and they are well taken. Sometimes I don't need to capture intermediate values, only need the latest value at the current moment. If I need to capture all value changes, I would probably use a queue to read/write.

 

User tst provided an answer to my question. Based on his/her answer, it would appear that a global variable access IS wrapped with a mutex.

 

If I need to do a read/modify/write to a global, even an FGV, I would need to implement my own mutex. Though an AE could be written to do this without an explicit mutex (the VI provides its own mutex).

0 Kudos
Message 11 of 15
(1,436 Views)

Hi Les,

 

tst and me essentially told you the same…

 

even an FGV, I would need to implement my own mutex.

You didn't understand: with an FGV you get your "mutex" for free as it encapsulates access to "global" data…

Best regards,
GerdW


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

Mutex or not, you'd still have race conditions if you have several concurrent writers.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 13 of 15
(1,418 Views)

I recommend having a good look at an example I put together: A Look At Race Conditions


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 14 of 15
(1,402 Views)

Look at my nugget on Action Engines.

 

I suspect that is the answer you are trying to find.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 15 of 15
(1,394 Views)