You maybe running into a race condition even though you are appending
the '?sync=true' tag is because the synchronous operation only ensures
that the dataflow proceeds after the the datasocket has communicated the
update to the shared variable engine. The race condition maybe caused
due to the time that the shared variable engine takes to update the
variable. The second iteration of the while loop may still read the
value of the SVRead variable from the previous iteration which might
cause a race condition. To avoid this possibility, I implemented a
tri-state SVRead variable. Instead of using a boolean, I used an
integer to check the status so that the Sender/Receiver do not wait for
the same value of SVRead which could potentially cause a race condition.
Assuming that the SVRead variable will be initialized to a '0' Value,
refer to the following image for more information on how the SVread
values are being cycled.
Also, I am attaching the editted version of your VIs so that you can test it out.
Please let me know if this helps in resolving the race condition.
Mehak D.