Multithreading help

In my project, one of the components has a list of active synthesizer voices that’s kept up to date by the voices (when their state changes they call a method in the component). I realized this is currently problematic, because the audio thread can update this list while it’s being iterated over in the draw method. Is there a thread-safe way I can do this? I can’t really lock these threads without creating lag. Is there some other way I can send messages to the drawing thread?

I saw some message related classes, but I couldn’t tell if they were relevant.

I could probably manage this directly from the drawing thread, but I was running into some complications, and this would ultimately be an easier way to handle voice changes.

The audio thread should never call methods of the GUI. Generally, the audio code should have no knowledge of the GUI, and the GUI just queries the audio code when it needs to.

Oh. I was starting to suspect that was the case given all the problems I was having.