STATIC ptable *lt_op_map = NULL;
#ifdef USE_ITHREADS
+
STATIC perl_mutex lt_op_map_mutex;
-#endif
+
+#define LT_LOCK(M) MUTEX_LOCK(M)
+#define LT_UNLOCK(M) MUTEX_UNLOCK(M)
+
+#else /* USE_ITHREADS */
+
+#define LT_LOCK(M)
+#define LT_UNLOCK(M)
+
+#endif /* !USE_ITHREADS */
typedef struct {
#ifdef MULTIPLICITY
#define lt_map_store(O, OP, TP, TM, PP) lt_map_store(aTHX_ (O), (OP), (TP), (TM), (PP))
lt_op_info *oi;
-#ifdef USE_ITHREADS
- MUTEX_LOCK(<_op_map_mutex);
-#endif
+ LT_LOCK(<_op_map_mutex);
if (!(oi = ptable_fetch(lt_op_map, o))) {
oi = PerlMemShared_malloc(sizeof *oi);
oi->old_pp_padsv = old_pp_padsv;
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(<_op_map_mutex);
-#endif
+ LT_UNLOCK(<_op_map_mutex);
}
STATIC const lt_op_info *lt_map_fetch(const OP *o, lt_op_info *oi) {
const lt_op_info *val;
-#ifdef USE_ITHREADS
- MUTEX_LOCK(<_op_map_mutex);
-#endif
+ LT_LOCK(<_op_map_mutex);
val = ptable_fetch(lt_op_map, o);
if (val) {
val = oi;
}
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(<_op_map_mutex);
-#endif
+ LT_UNLOCK(<_op_map_mutex);
return val;
}
STATIC void lt_map_delete(pTHX_ const OP *o) {
#define lt_map_delete(O) lt_map_delete(aTHX_ (O))
-#ifdef USE_ITHREADS
- MUTEX_LOCK(<_op_map_mutex);
-#endif
+ LT_LOCK(<_op_map_mutex);
ptable_map_delete(lt_op_map, o);
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(<_op_map_mutex);
-#endif
+ LT_UNLOCK(<_op_map_mutex);
}
/* --- Hooks --------------------------------------------------------------- */
switch (o->op_type) {
case OP_PADSV:
if (o->op_ppaddr != lt_pp_padsv && o->op_private & OPpLVAL_INTRO) {
-#ifdef USE_ITHREADS
- MUTEX_LOCK(<_op_map_mutex);
-#endif
+ LT_LOCK(<_op_map_mutex);
oi = ptable_fetch(lt_op_map, o);
if (oi) {
oi->old_pp_padsv = o->op_ppaddr;
o->op_ppaddr = lt_pp_padsv;
}
-#ifdef USE_ITHREADS
- MUTEX_UNLOCK(<_op_map_mutex);
-#endif
+ LT_UNLOCK(<_op_map_mutex);
}
break;
#if !LT_HAS_RPEEP