This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use SSize_t for read lock counter
authorKarl Williamson <khw@cpan.org>
Thu, 31 Dec 2020 16:08:21 +0000 (09:08 -0700)
committerKarl Williamson <khw@cpan.org>
Thu, 31 Dec 2020 16:12:53 +0000 (09:12 -0700)
We have tests to make sure this doesn't go negative, but wrongly
declared the variable as unsigned.

Spotted by Craig Berry.

perl.h

diff --git a/perl.h b/perl.h
index cbb6905..9627f34 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -3345,7 +3345,7 @@ typedef pthread_key_t     perl_key;
 typedef struct {
     perl_mutex lock;
     perl_cond  wakeup;
-    Size_t     readers_count;
+    SSize_t    readers_count;
 } perl_RnW1_mutex_t;