Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread Adjust memory barriers.



details:   https://anonhg.NetBSD.org/src/rev/bbd788477bef
branches:  trunk
changeset: 972856:bbd788477bef
user:      ad <ad%NetBSD.org@localhost>
date:      Thu Jun 11 18:41:22 2020 +0000

description:
Adjust memory barriers.

diffstat:

 lib/libpthread/pthread_mutex.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r f40f10cce810 -r bbd788477bef lib/libpthread/pthread_mutex.c
--- a/lib/libpthread/pthread_mutex.c    Thu Jun 11 16:05:54 2020 +0000
+++ b/lib/libpthread/pthread_mutex.c    Thu Jun 11 18:41:22 2020 +0000
@@ -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 @@
                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 @@
        /* 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;



Home | Main Index | Thread Index | Old Index