Support for MAIN_LOOP_HOOK