STATIC perl_mutex a_op_map_mutex;
+#define A_LOCK(M) MUTEX_LOCK(M)
+#define A_UNLOCK(M) MUTEX_UNLOCK(M)
+
STATIC const a_op_info *a_map_fetch(const OP *o, a_op_info *oi) {
const a_op_info *val;
- MUTEX_LOCK(&a_op_map_mutex);
+ A_LOCK(&a_op_map_mutex);
val = ptable_fetch(a_op_map, o);
if (val) {
val = oi;
}
- MUTEX_UNLOCK(&a_op_map_mutex);
+ A_UNLOCK(&a_op_map_mutex);
return val;
}
#define dA_MAP_THX dNOOP
+#define A_LOCK(M) NOOP
+#define A_UNLOCK(M) NOOP
+
#define a_map_fetch(O) ptable_fetch(a_op_map, (O))
#endif /* !USE_ITHREADS */
STATIC void a_map_store(pPTBLMS_ const OP *o, OP *(*old_pp)(pTHX), void *next, UV flags) {
#define a_map_store(O, PP, N, F) a_map_store(aPTBLMS_ (O), (PP), (N), (F))
-
-#ifdef USE_ITHREADS
- MUTEX_LOCK(&a_op_map_mutex);
-#endif
+ A_LOCK(&a_op_map_mutex);
a_map_store_locked(o, old_pp, next, flags);
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(&a_op_map_mutex);
-#endif
+ A_UNLOCK(&a_op_map_mutex);
}
STATIC void a_map_delete(pTHX_ const OP *o) {
#define a_map_delete(O) a_map_delete(aTHX_ (O))
-#ifdef USE_ITHREADS
- MUTEX_LOCK(&a_op_map_mutex);
-#endif
+ A_LOCK(&a_op_map_mutex);
ptable_map_delete(a_op_map, o);
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(&a_op_map_mutex);
-#endif
+ A_UNLOCK(&a_op_map_mutex);
}
STATIC const OP *a_map_descend(const OP *o) {
a_op_info *oi;
const OP *o = root;
-#ifdef USE_ITHREADS
- MUTEX_LOCK(&a_op_map_mutex);
-#endif
+ A_LOCK(&a_op_map_mutex);
roi = a_map_store_locked(o, old_pp, (OP *) root, flags | A_HINT_ROOT);
}
}
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(&a_op_map_mutex);
-#endif
+ A_UNLOCK(&a_op_map_mutex);
return;
}
a_op_info *oi;
const OP *o = root;
-#ifdef USE_ITHREADS
- MUTEX_LOCK(&a_op_map_mutex);
-#endif
+ A_LOCK(&a_op_map_mutex);
flags &= ~A_HINT_ROOT;
o = a_map_descend(o);
} while (o);
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(&a_op_map_mutex);
-#endif
+ A_UNLOCK(&a_op_map_mutex);
return;
}
STATIC void a_map_update_flags_bottomup(const OP *o, UV flags, UV rflags) {
a_op_info *oi;
-#ifdef USE_ITHREADS
- MUTEX_LOCK(&a_op_map_mutex);
-#endif
+ A_LOCK(&a_op_map_mutex);
flags &= ~A_HINT_ROOT;
rflags |= A_HINT_ROOT;
}
oi->flags = rflags;
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(&a_op_map_mutex);
-#endif
+ A_UNLOCK(&a_op_map_mutex);
return;
}