This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
build test for the read/write mutex macros
authorTony Cook <tony@develop-help.com>
Mon, 14 Dec 2020 04:20:17 +0000 (15:20 +1100)
committerKarl Williamson <khw@cpan.org>
Mon, 14 Dec 2020 20:25:17 +0000 (13:25 -0700)
This fails to compile

ext/XS-APItest/APItest.xs
thread.h

index 549bf54..acfbe22 100644 (file)
@@ -6936,6 +6936,31 @@ Comctl32Version()
 #endif
 
 
+MODULE = XS::APItest                PACKAGE = XS::APItest::RWMacro
+
+#if defined(USE_ITHREADS)
+
+void
+compile_macros()
+    PREINIT:
+        perl_RnW1_mutex_t m;
+       perl_RnW1_mutex_t *pm = &m;
+    CODE:
+        PERL_RW_MUTEX_INIT(&m);
+        PERL_WRITE_LOCK(&m);
+        PERL_WRITE_UNLOCK(&m);
+        PERL_READ_LOCK(&m);
+        PERL_READ_UNLOCK(&m);
+        PERL_RW_MUTEX_DESTROY(&m);
+        PERL_RW_MUTEX_INIT(pm);
+        PERL_WRITE_LOCK(pm);
+        PERL_WRITE_UNLOCK(pm);
+        PERL_READ_LOCK(pm);
+        PERL_READ_UNLOCK(pm);
+        PERL_RW_MUTEX_DESTROY(pm);
+
+#endif
+
 MODULE = XS::APItest                PACKAGE = XS::APItest::HvMacro
 
 
index 14fc1c5..3802071 100644 (file)
--- a/thread.h
+++ b/thread.h
 #  define PERL_READ_UNLOCK        NOOP
 #  define PERL_WRITE_LOCK         NOOP
 #  define PERL_WRITE_UNLOCK       NOOP
+#  define PERL_RW_MUTEX_INIT      NOOP
+#  define PERL_RW_MUTEX_DESTROY   NOOP
 #endif
 
 #ifndef LOCK_DOLLARZERO_MUTEX