as the title already suggests, I know that you shouldn’t lock the GUI thread.
This being said, on a scale from 1 to
#define true 0, how evil is calling runDispatchLoopUntil() given the fact that it’s the last resort (with values below 20 ms) ? The code will never run on Android, so modal loops are not per se impossible, but it will definitely run in plugins and iOS and I know Jules stated in another thread that it’s particularly troublesome in a plugin scenario.
What might go wrong there? I don’t care about unresponsiveness in this case (it’s just an edge case situation where the execution of a script needs to pause until all voices are killed (usually within 30-40ms) so that the audio thread can be suspended during the construction of a larger object).
Using a state-machine solution in this scenario would mean winding up the stacktrace of the script execution and resume at exact this point, which is possible, but definitely not on my list of “fun things to code”.