summaryrefslogtreecommitdiff
path: root/thread.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-11-30 12:18:30 -0700
committerKarl Williamson <khw@cpan.org>2020-12-06 14:53:13 -0700
commit72dfa47e497a43e6eecdb2129fa447723802949e (patch)
tree1d4106222128bbca24ea13261154bc166d2d56c3 /thread.h
parentc4f0298e584ffdec51fd94828dbb94caf74446ae (diff)
downloadperl-72dfa47e497a43e6eecdb2129fa447723802949e.tar.gz
Add start-up/tear-down for many-reader mutexes
These were missed in 5640a370e8b19af74b8ca0b4694464c21a87916b.
Diffstat (limited to 'thread.h')
-rw-r--r--thread.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/thread.h b/thread.h
index eafb75e6fa..96430b95e2 100644
--- a/thread.h
+++ b/thread.h
@@ -319,6 +319,19 @@
# define PERL_WRITE_UNLOCK(mutex) MUTEX_UNLOCK(mutex.lock)
+# define PERL_RW_MUTEX_INIT(mutex) \
+ STMT_START { \
+ MUTEX_INIT(mutex.lock); \
+ COND_INIT(mutex.zero_readers); \
+ (mutex)->readers_count = 0; \
+ } STMT_END
+
+# define PERL_RW_MUTEX_DESTROY(mutex) \
+ STMT_START { \
+ COND_DESTROY(mutex.zero_readers); \
+ MUTEX_DESTROY(mutex.lock); \
+ } STMT_END
+
#endif
/* DETACH(t) must only be called while holding t->mutex */