+
+static I32 vmg_loaded = 0;
+
+/* We must use preexistent global mutexes or we will never be able to destroy
+ * them. */
+# if VMG_HAS_PERL(5, 9, 3)
+# define VMG_LOADED_LOCK MUTEX_LOCK(&PL_my_ctx_mutex)
+# define VMG_LOADED_UNLOCK MUTEX_UNLOCK(&PL_my_ctx_mutex)
+# else
+# define VMG_LOADED_LOCK OP_REFCNT_LOCK
+# define VMG_LOADED_UNLOCK OP_REFCNT_UNLOCK
+# endif
+
+static void vmg_global_teardown_late_locked(pTHX) {
+#define vmg_global_teardown_late_locked() vmg_global_teardown_late_locked(aTHX)