ext/oj/object.c in oj-2.2.1 vs ext/oj/object.c in oj-2.2.2
- old
+ new
@@ -261,12 +261,14 @@
copy_ivars(parent->val, prev);
} else if (3 == klen && 0 == strncmp("~bt", key, klen)) {
rb_funcall(parent->val, rb_intern("set_backtrace"), 1, value);
}
}
-#if SAFE_CACHE
+#if USE_PTHREAD_MUTEX
pthread_mutex_lock(&oj_cache_mutex);
+#elif USE_RB_MUTEX
+ rb_mutex_lock(oj_cache_mutex);
#endif
if (0 == (var_id = oj_attr_hash_get(key, klen, &slot))) {
char attr[256];
if (sizeof(attr) <= klen + 2) {
@@ -293,11 +295,13 @@
}
var_id = rb_intern(attr);
}
*slot = var_id;
}
-#if SAFE_CACHE
+#if USE_PTHREAD_MUTEX
pthread_mutex_unlock(&oj_cache_mutex);
+#elif USE_RB_MUTEX
+ rb_mutex_unlock(oj_cache_mutex);
#endif
rb_ivar_set(parent->val, var_id, value);
}
static void