This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PERL_WRITE_UNLOCK: add missing condition signal
authorKarl Williamson <khw@cpan.org>
Thu, 10 Dec 2020 18:07:15 +0000 (11:07 -0700)
committerKarl Williamson <khw@cpan.org>
Sat, 12 Dec 2020 15:58:30 +0000 (08:58 -0700)
The mutex is locked, and any contenders are awaiting a signal, which
until this commit was missing.

thread.h

index 96430b9..b34af65 100644 (file)
--- a/thread.h
+++ b/thread.h
         /* Here, the mutex is locked, with no readers */            \
     } STMT_END
 
-#  define PERL_WRITE_UNLOCK(mutex)  MUTEX_UNLOCK(mutex.lock)
+#  define PERL_WRITE_UNLOCK(mutex)                                  \
+    STMT_START {                                                    \
+        COND_SIGNAL(mutex.readers_now_zero);                        \
+        MUTEX_UNLOCK(mutex.lock);                                   \
+    } STMT_END
 
 #  define PERL_RW_MUTEX_INIT(mutex)                                 \
     STMT_START {                                                    \