Module Name:    src
Committed By:   ad
Date:           Thu Jun 11 18:41:22 UTC 2020

Modified Files:
        src/lib/libpthread: pthread_mutex.c

Log Message:
Adjust memory barriers.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/lib/libpthread/pthread_mutex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread_mutex.c
diff -u src/lib/libpthread/pthread_mutex.c:1.80 src/lib/libpthread/pthread_mutex.c:1.81
--- src/lib/libpthread/pthread_mutex.c:1.80	Wed Jun 10 22:45:15 2020
+++ src/lib/libpthread/pthread_mutex.c	Thu Jun 11 18:41:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_mutex.c,v 1.80 2020/06/10 22:45:15 ad Exp $	*/
+/*	$NetBSD: pthread_mutex.c,v 1.81 2020/06/11 18:41:22 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2003, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_mutex.c,v 1.80 2020/06/10 22:45:15 ad Exp $");
+__RCSID("$NetBSD: pthread_mutex.c,v 1.81 2020/06/11 18:41:22 ad Exp $");
 
 #include <sys/types.h>
 #include <sys/lwpctl.h>
@@ -532,7 +532,7 @@ pthread__mutex_wakeup(pthread_t self, st
 		next = cur->next;
 		pthread__assert(cur->lid != 0);
 		lids[nlid++] = cur->lid;
-		membar_sync();
+		membar_exit();
 		cur->lid = 0;
 		/* No longer safe to touch 'cur' */
 	}
@@ -719,6 +719,9 @@ pthread__mutex_deferwake(pthread_t self,
 	/* Append atomically. */
 	for (o = ptm->ptm_waiters;; o = n) {
 		tail->next = o;
+#ifndef PTHREAD__ATOMIC_IS_MEMBAR
+		membar_producer();
+#endif
 		n = atomic_cas_ptr(&ptm->ptm_waiters, o, head);
 		if (__predict_true(n == o)) {
 			break;

Reply via email to