Skip to content

Commit 0b83dfe

Browse files
committed
many-reader mutexes: Change structure element name
The old name did not encompass all the possible reasons for the mutex signal condition to be invoked
1 parent 2cca577 commit 0b83dfe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

perl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3344,7 +3344,7 @@ typedef pthread_key_t perl_key;
33443344
/* Many readers; single writer */
33453345
typedef struct {
33463346
perl_mutex lock;
3347-
perl_cond zero_readers;
3347+
perl_cond wakeup;
33483348
Size_t readers_count;
33493349
} perl_RnW1_mutex_t;
33503350

thread.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@
298298
MUTEX_LOCK(mutex.lock); \
299299
(mutex)->readers_count--; \
300300
if ((mutex)->readers_count <= 0) { \
301-
COND_SIGNAL(mutex.zero_readers); \
301+
COND_SIGNAL(mutex.wakeup); \
302302
(mutex)->readers_count = 0; \
303303
} \
304304
MUTEX_UNLOCK(mutex.lock); \
@@ -310,7 +310,7 @@
310310
do { \
311311
if ((mutex)->readers_count == 0) \
312312
break; \
313-
COND_WAIT(mutex.zero_readers, mutex.lock); \
313+
COND_WAIT(mutex.wakeup, mutex.lock); \
314314
} \
315315
while (1); \
316316
\
@@ -319,20 +319,20 @@
319319

320320
# define PERL_WRITE_UNLOCK(mutex) \
321321
STMT_START { \
322-
COND_SIGNAL(mutex.readers_now_zero); \
322+
COND_SIGNAL(mutex.wakeup); \
323323
MUTEX_UNLOCK(mutex.lock); \
324324
} STMT_END
325325

326326
# define PERL_RW_MUTEX_INIT(mutex) \
327327
STMT_START { \
328328
MUTEX_INIT(mutex.lock); \
329-
COND_INIT(mutex.zero_readers); \
329+
COND_INIT(mutex.wakeup); \
330330
(mutex)->readers_count = 0; \
331331
} STMT_END
332332

333333
# define PERL_RW_MUTEX_DESTROY(mutex) \
334334
STMT_START { \
335-
COND_DESTROY(mutex.zero_readers); \
335+
COND_DESTROY(mutex.wakeup); \
336336
MUTEX_DESTROY(mutex.lock); \
337337
} STMT_END
338338

0 commit comments

Comments
 (0)