]> git.vpit.fr Git - perl/modules/Variable-Magic.git/commitdiff
Make sure the load refcount is reset on global setup
authorVincent Pit <vince@profvince.com>
Tue, 14 Apr 2015 14:46:12 +0000 (11:46 -0300)
committerVincent Pit <vince@profvince.com>
Tue, 14 Apr 2015 14:49:53 +0000 (11:49 -0300)
Magic.xs

index 207fcb383a75a3162632239b0cc74c7ff5335504..947ae72a0246b945f2759deaaa5cbff9afe43382 100644 (file)
--- a/Magic.xs
+++ b/Magic.xs
@@ -1881,12 +1881,14 @@ static void vmg_setup(pTHX) {
 #if VMG_THREADSAFE
  VMG_LOADED_LOCK;
 
- if (vmg_loaded <= 0) {
-  assert(vmg_loaded == 0);
+ if (vmg_loaded == 0) {
   MUTEX_INIT(&vmg_vtable_refcount_mutex);
   MUTEX_INIT(&vmg_op_name_init_mutex);
+  vmg_loaded = 1;
+ } else {
+  assert(vmg_loaded > 0);
+  ++vmg_loaded;
  }
- ++vmg_loaded;
 
  VMG_LOADED_UNLOCK;
 #endif