I would like to see something such as a "Synchronous property update block" as an easy way to prevent race conditions when updating front panel objects.

Let's say I have two inherently asynchronous threads that both want to modify a front panel object, by first reading its value (or a property), changing it somehow, then writing the new value (or property) back. There is a risk of a race condition if the first thread is interrupted after reading (but before updating) the value – and this seems to occur with tables, graphs, etc. – particularly when the data size gets large.
What I propose is a structure with symmetric input/output groups, like an in-place structure. But in this case, the input/output terminals would be one or more local variable selectors or, even better, property node selectors that could be either hard-linked or wired with a reference. During execution of this block, all other threads are blocked from either (a) writing properties or values to any of the linked/referenced FP objects, or (b), entering into any other synchronous update blocks that are linked to any of the same FP objects.
Sure, there are other ways to get around this, but…
- Semaphores and other synchronization functions seem a bit cumbersome for such a simple (and frequent) task, and are unnecessarily prone to deadlock
- Using a functional global would duplicate the data in memory, I’d rather just keep it in the FP object.
- Other possible fixes (e.g., manually synchronizing the code, forcing synchronous updates for the indicators, deferring panel update, or using local variables instead of property nodes) all seem to sacrifice of performance and/or functionality. I’m not positive the latter options would actually prevent the race – they might just lower the probability.
On the other hand, a synchronous update block could:
- Automatically prevent deadlocks – LabVIEW could just lock controls and indicators in a consistent order to prevent a circular wait condition. And of course, we would know better than to nest a mutex wait, I/O, or anything else foolish inside these blocks... right?
- Operate independently from other synchronization instruments and thus not unnecessarily stall other threads or the front panel (i.e., other threads can still READ locked controls during the synchronous update, or modify and update other controls)
- Promote better coding and data flow by distinguishing between FP update tasks and other processing / IO / etc...
Finally, if these block structures further supported iteration (that is, like a for loop that buffers all the property node writes until the loop is complete), you could get a way to temporarily defer front panel updates for individual objects – e.g., for tasks such as coloring table cells or populating a graph legend. See the "’Defer Panel Updates’ within sequence frame so configured” idea – or the “Make Defer Updates an Object Property as well as a Panel Property.”
http://forums.ni.com/t5/LabVIEW-Idea-Exchange/quot-Defer-Panel-Updates-quot-within-sequence-frame-so/idi-p/1288952
http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Make-Defer-Updates-an-Object-Property-as-well-as-a-Panel/idi-p/1292100