express your logic in a generator, then use these wrappers to run your code as blocking, async (main loop) or async (threaded)