Using Perl and
Coro does seem to be the way to go, load Perl + Coro into your application, have each script you need to run be a separate Coro thread (really just a perl context), and when it calls back into your code, suspend that specific thread and unsuspend it on return from your code. You should still avoid Perl code that blocks for other reasons but it wouldn't block on calling back into your code.