If your actions are small enough, you could try to do the trick I used in a simpleminded modular synthesizer: replace your MainLoop with something like:
while (1) {
DoOneEvent(DONT_WAIT);
# do your own (short) action
select undef,undef,undef,0.0001;
}