Ok, so I know this comes up a lot, but I still don’t have a satisfying answer.
I need to be able to set a value from the audio thread, that after some dispatching gets written to a value tree on the message thread.
Just so I understand things correctly:
AsyncUpdater::triggerAsyncUpdate() should not be called from the audio thread, because this will post a message, which allocates, i.e. blocks? This would have been my absolute favourite of doing what I’m trying to do.
Forum solution: Use a timer on the message thread that reads the value from a lock-free fifo or atomic.
I want to use this to build myself a threadsafe lock-free datamodel based on the value tree. Let’s say I want to use this with ~200 parameters. Each parameter would run a timer at 30 Hz to check for new value (so UI is able to update fast enough). I don’t like polling too much. Is there no better way to trigger an async update on the message thread? I really hate lock-free programing but I can’t run away anymore.