diff options
author | sephe <sephe@FreeBSD.org> | 2016-06-23 02:21:37 +0000 |
---|---|---|
committer | sephe <sephe@FreeBSD.org> | 2016-06-23 02:21:37 +0000 |
commit | ee9748f41f5818197d95b210279c755ad824dba7 (patch) | |
tree | 2a57196e39be8e665ce0e0b939e6b203603778ab /share/man | |
parent | d5f44be4cd4d07380dce8e2eea32f6a97306d468 (diff) | |
download | FreeBSD-src-ee9748f41f5818197d95b210279c755ad824dba7.zip FreeBSD-src-ee9748f41f5818197d95b210279c755ad824dba7.tar.gz |
MFC 299912
atomic: Add testandclear on i386/amd64
Reviewed by: kib
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6381
Diffstat (limited to 'share/man')
-rw-r--r-- | share/man/man9/atomic.9 | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/share/man/man9/atomic.9 b/share/man/man9/atomic.9 index 5939b9c..fdeb0d3 100644 --- a/share/man/man9/atomic.9 +++ b/share/man/man9/atomic.9 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 14, 2015 +.Dd May 12, 2016 .Dt ATOMIC 9 .Os .Sh NAME @@ -65,6 +65,8 @@ .Ft <type> .Fn atomic_swap_<type> "volatile <type> *p" "<type> v" .Ft int +.Fn atomic_testandclear_<type> "volatile <type> *p" "u_int v" +.Ft int .Fn atomic_testandset_<type> "volatile <type> *p" "u_int v" .Sh DESCRIPTION Each of the atomic operations is guaranteed to be atomic across multiple @@ -313,6 +315,15 @@ and .Dq Li 16 and do not have any variants with memory barriers at this time. .Bl -hang +.It Fn atomic_testandclear p v +.Bd -literal -compact +bit = 1 << (v % (sizeof(*p) * NBBY)); +tmp = (*p & bit) != 0; +*p &= ~bit; +return (tmp); +.Ed +.El +.Bl -hang .It Fn atomic_testandset p v .Bd -literal -compact bit = 1 << (v % (sizeof(*p) * NBBY)); @@ -324,6 +335,8 @@ return (tmp); .Pp The .Fn atomic_testandset +and +.Fn atomic_testandclear functions are only implemented for the types .Dq Li int , .Dq Li long @@ -352,6 +365,8 @@ and functions return the value at the specified address. The .Fn atomic_testandset +and +.Fn atomic_testandclear function returns the result of the test operation. .Sh EXAMPLES This example uses the @@ -429,3 +444,6 @@ and .Fn atomic_testandset operations were added in .Fx 10.0 . +.Fn atomic_testandclear +operation was added in +.Fx 11.0 . |