diff --git a/ext/fox16_c/include/gvl_wrappers.h b/ext/fox16_c/include/gvl_wrappers.h
index 918a99a6cf70a9952e5835fc1db68112ab6fc618..e93a4afd986fda4259f7fdf33aad1e019b0fcd2f 100644
--- a/ext/fox16_c/include/gvl_wrappers.h
+++ b/ext/fox16_c/include/gvl_wrappers.h
@@ -120,7 +120,9 @@ extern __thread int g_fxrb_thread_has_gvl;
         struct gvl_wrapper_##name##_##paramcount##_params<firstparamtype FOR_EACH_PARAM_OF_##name##_##paramcount(DEFINE_PARAM_LIST5)> params = { \
           {firstparamname FOR_EACH_PARAM_OF_##name##_##paramcount(DEFINE_PARAM_LIST1)}, when_non_void((rettype)0) \
         }; \
+        g_fxrb_thread_has_gvl = 1; \
         rb_thread_call_with_gvl(gvl_##name##_##paramcount##_skeleton<firstparamtype FOR_EACH_PARAM_OF_##name##_##paramcount(DEFINE_PARAM_LIST5)>, &params); \
+        g_fxrb_thread_has_gvl = 0; \
         when_non_void( return params.retval; ) \
       } \
     }