Source-Changes-HG archive

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

[src/trunk]: src/common/lib/libc/atomic Make the _and_fetch_8 primitives retu...



details:   https://anonhg.NetBSD.org/src/rev/4da738e2b032
branches:  trunk
changeset: 326800:4da738e2b032
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Feb 18 13:21:04 2014 +0000

description:
Make the _and_fetch_8 primitives return the new value they calculated
and set - not whatever is found in memory later.

diffstat:

 common/lib/libc/atomic/atomic_nand_64_cas.c |  4 ++--
 common/lib/libc/atomic/atomic_sub_64_cas.c  |  4 ++--
 common/lib/libc/atomic/atomic_xor_64_cas.c  |  4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r d64e6e9c6b51 -r 4da738e2b032 common/lib/libc/atomic/atomic_nand_64_cas.c
--- a/common/lib/libc/atomic/atomic_nand_64_cas.c       Tue Feb 18 12:32:12 2014 +0000
+++ b/common/lib/libc/atomic/atomic_nand_64_cas.c       Tue Feb 18 13:21:04 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_nand_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $    */
+/*     $NetBSD: atomic_nand_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $    */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
                old = *addr;
                new = ~(old & val);
        } while (atomic_cas_64(addr, old, new) != old);
-       return *addr;
+       return new;
 }
 
 #endif
diff -r d64e6e9c6b51 -r 4da738e2b032 common/lib/libc/atomic/atomic_sub_64_cas.c
--- a/common/lib/libc/atomic/atomic_sub_64_cas.c        Tue Feb 18 12:32:12 2014 +0000
+++ b/common/lib/libc/atomic/atomic_sub_64_cas.c        Tue Feb 18 13:21:04 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_sub_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $     */
+/*     $NetBSD: atomic_sub_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $     */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
                old = *addr;
                new = old - val;
        } while (atomic_cas_64(addr, old, new) != old);
-       return *addr;
+       return new;
 }
 
 #endif
diff -r d64e6e9c6b51 -r 4da738e2b032 common/lib/libc/atomic/atomic_xor_64_cas.c
--- a/common/lib/libc/atomic/atomic_xor_64_cas.c        Tue Feb 18 12:32:12 2014 +0000
+++ b/common/lib/libc/atomic/atomic_xor_64_cas.c        Tue Feb 18 13:21:04 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic_xor_64_cas.c,v 1.1 2014/02/18 10:16:55 martin Exp $     */
+/*     $NetBSD: atomic_xor_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $     */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
                old = *addr;
                new = old ^ val;
        } while (atomic_cas_64(addr, old, new) != old);
-       return *addr;
+       return new;
 }
 
 #endif



Home | Main Index | Thread Index | Old Index