backport emulation of rb_thread_call_without_gvl