summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-08 12:08:17 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-08 12:08:17 +0000
commit534825c439e9bf017f3cdaf88d284d58d5eac6bd (patch)
tree1884c58f0eef7d68e5cd924efde5a05d8c8b6e0b /op.h
parente23b9d0f648442d8e275530c0bf8b0027cee41d1 (diff)
downloadperl-534825c439e9bf017f3cdaf88d284d58d5eac6bd.tar.gz
add missing locks for op refcounts
p4raw-id: //depot/perl@5610
Diffstat (limited to 'op.h')
-rw-r--r--op.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/op.h b/op.h
index c9ec2df6f0..da03aa46db 100644
--- a/op.h
+++ b/op.h
@@ -401,3 +401,20 @@ struct loop {
#define OA_SCALARREF 7
#define OA_OPTIONAL 8
+#ifdef USE_ITHREADS
+# define OP_REFCNT_INIT MUTEX_INIT(&PL_op_mutex)
+# define OP_REFCNT_LOCK MUTEX_LOCK(&PL_op_mutex)
+# define OP_REFCNT_UNLOCK MUTEX_UNLOCK(&PL_op_mutex)
+# define OP_REFCNT_TERM MUTEX_DESTROY(&PL_op_mutex)
+# define OpREFCNT_set(o,n) ((o)->op_targ = (n))
+# define OpREFCNT_inc(o) ((o) ? (++(o)->op_targ, (o)) : Nullop)
+# define OpREFCNT_dec(o) (--(o)->op_targ)
+#else
+# define OP_REFCNT_INIT NOOP
+# define OP_REFCNT_LOCK NOOP
+# define OP_REFCNT_UNLOCK NOOP
+# define OP_REFCNT_TERM NOOP
+# define OpREFCNT_set(o,n) NOOP
+# define OpREFCNT_inc(o) (o)
+# define OpREFCNT_dec(o) 0
+#endif