LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
David_L

Shared Variables: Wait until updated for write

Status: New

Most people know that Network Published Shared variables are pretty slow.  If you write to a SV and then immediately read from it, you probably will not see the new updated value.  One way to get around this is to write the value and then continuously read and compare the SV until the value is updated:

 

19125iABB76509B98916BC

Pretty straightforward to do, but takes time to set up, as well as some Block Diagram real estate.  

 

I think it would be pretty convenient (and easy for NI to implement) if there was an option for a SV to wait until updated.

 

It could either be an option from the right click menu, (that of course would update the icon to signify that it's now a blocking call) or use an input to the variable, or maybe a combination of both:

 

19137i8D45A8D78F9A98A9

3 Comments
crossrulz
Knight of NI

If you are waiting for an update, you should also signify a timeout.  I'm envisioning the SV being used like a notifier right now, which would be very useful.


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
Brian_Powell
Active Participant

Would it be better to have a write-through cache?  I.e., if I write to a shared variable, I remember the value I wrote, and use that until the shared variable engine tells me that it has a newer value?

 

I think this would avoid the current (silly--oh, did I say that?) behavior that you can't reliably read back what you wrote.

 

I haven't really thought about the implications of multiple processes here.  The write-through cache might be better, in that it will always eventually update--probably as quickly as it would have without the cache.

 

Brian

 

Vaibhav
Active Participant

The problem with such a feature could be that in case the shared variable never gets updated, the VI could go into an infinite loop kind of execution, and will require only forced abortion.

 

Also, there is a "Time Out?" output option for "Read" variables, and this helps to check if the value was updated or not. 

Vaibhav