How to lock ValueTrees

I was using a lock-free Fifo to transfer the synchronization data from one thread to other.

So, you’re copying the data on the message thread to the other thread, which is what I was suggesting. I don’t think you have to use a lock-free fifo, as this is not the real time thread. A simple lock around the copy which would be shared with with the parser should be fine and probably faster/simpler to write and maintain.

What I was trying to say is due to the nature of ValueTree (many unconnected nodes) you can’t write to it from one thread (using the Tree Synchronizer) and expect the data to be ‘complete’ on the other thread as you access it.

That’s why the approach I suggest would be to lock (make sure other thread isn’t accessing the data), do the copy, then process freely on both threads.

Just throwing in the ValueTreeSynchroniser, maybe that is useful for the shadow tree approach…