[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Sat May 27 20:37:41 UTC 2017


The branch master has been updated
       via  6891a79da67ccd621b67e49b60ddc188d7864291 (commit)
      from  df578aa01314acd072038b703ac3ec002208da03 (commit)


- Log -----------------------------------------------------------------
commit 6891a79da67ccd621b67e49b60ddc188d7864291
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat May 27 22:04:59 2017 +0200

    Add internal functions to fetch a refcount
    
    Reviewed-by: Tim Hudson <tjh at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/3573)

-----------------------------------------------------------------------

Summary of changes:
 include/internal/refcount.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/internal/refcount.h b/include/internal/refcount.h
index 591561f..1aea71b 100644
--- a/include/internal/refcount.h
+++ b/include/internal/refcount.h
@@ -22,6 +22,12 @@
 
 typedef _Atomic int CRYPTO_REF_COUNT;
 
+static ossl_inline int CRYPTO_GET_REF(_Atomic int *val, int *ret, void *lock)
+{
+    *ret = atomic_fetch_add_explicit(val, 0, memory_order_relaxed);
+    return 1;
+}
+
 static ossl_inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
 {
     *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
@@ -42,6 +48,12 @@ static ossl_inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
 
 typedef int CRYPTO_REF_COUNT;
 
+static ossl_inline int CRYPTO_GET_REF(_Atomic int *val, int *ret, void *lock)
+{
+    *ret = __atomic_fetch_add(val, 0, __ATOMIC_RELAXED);
+    return 1;
+}
+
 static ossl_inline int CRYPTO_UP_REF(int *val, int *ret, void *lock)
 {
     *ret = __atomic_fetch_add(val, 1, __ATOMIC_RELAXED) + 1;
@@ -60,6 +72,7 @@ static ossl_inline int CRYPTO_DOWN_REF(int *val, int *ret, void *lock)
 
 typedef int CRYPTO_REF_COUNT;
 
+# define CRYPTO_GET_REF(val, ret, lock) CRYPTO_atomic_add(val, 0, ret, lock)
 # define CRYPTO_UP_REF(val, ret, lock) CRYPTO_atomic_add(val, 1, ret, lock)
 # define CRYPTO_DOWN_REF(val, ret, lock) CRYPTO_atomic_add(val, -1, ret, lock)
 


More information about the openssl-commits mailing list