How to lock ValueTrees

A beast indeed!

My ValueTree structure contains lots of user input Strings which the system parses as scripting commands. This is the process I wanted to separate from the message thread–the parsing is fairly CPU intensive, and runs very frequently on a 50ms timer. Some of these commands will alter the structure of the tree, so it definitely will call removeChild().

I thought about using a lock free solution as in this post:

However, I’m not sure that it would actually be any easier to implement, and the asynchronicity might introduce other complications.

Of course, the other solution is to keep the whole thing running on the message thread (if it aint broke, don’t fix it). But the parsing is quite heavy, and it seems like multi-threading could really improve performance here.