Consequences of blocking in callbacks

For a few weeks now I’ve been working on writing Ruby bindings to FMOD, and I actually managed to get callbacks working.

Ruby is extremely fussy about running Ruby code on threads not made by Ruby, like the threads FMOD uses to run callbacks, so I ended up setting up a system that runs FMOD callbacks in a Ruby thread. (It requests that the Ruby thread runs a callback and then waits for that callback to finish.)

Unfortunately, this means that the callback blocks until Ruby gets around to running it (Ruby does not support true multithreading- only one thread can actually execute at a time) which can take a while in comparison to callbacks FMOD is designed to be running.

I haven’t seen any negatives from doing this, however I may be wrong and I’d like to know if there are any?


Blocking any FMOD thread will have consequences, depending on which thread is and how long you block for will determine what those are. For instance, blocking the mixer thread will cause stuttering if the blocking time is longer than the DSP ring buffer size. Blocking the Studio update thread will cause scheduling accuracy issues if the blocking time is longer than the scheduler’s lookahead time.

Hope this helps!