summaryrefslogtreecommitdiffstats
path: root/crypto/dso
diff options
context:
space:
mode:
authorKurt Roeckx <kurt@roeckx.be>2016-08-27 16:01:08 +0200
committerKurt Roeckx <kurt@roeckx.be>2016-11-17 22:02:25 +0100
commit2f545ae45d4b93649e40ff7f93e2c3e6ce3154ae (patch)
treef29ebce27f6c271c3e7f99a3f96df6c4aadd5404 /crypto/dso
parentSupport MSBLOB format if RC4 is disabled (diff)
downloadopenssl-2f545ae45d4b93649e40ff7f93e2c3e6ce3154ae.tar.xz
openssl-2f545ae45d4b93649e40ff7f93e2c3e6ce3154ae.zip
Add support for reference counting using C11 atomics
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #1500
Diffstat (limited to 'crypto/dso')
-rw-r--r--crypto/dso/dso_lib.c4
-rw-r--r--crypto/dso/dso_locl.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c
index 52816dfb9d..8f185b3828 100644
--- a/crypto/dso/dso_lib.c
+++ b/crypto/dso/dso_lib.c
@@ -65,7 +65,7 @@ int DSO_free(DSO *dso)
if (dso == NULL)
return (1);
- if (CRYPTO_atomic_add(&dso->references, -1, &i, dso->lock) <= 0)
+ if (CRYPTO_DOWN_REF(&dso->references, &i, dso->lock) <= 0)
return 0;
REF_PRINT_COUNT("DSO", dso);
@@ -107,7 +107,7 @@ int DSO_up_ref(DSO *dso)
return 0;
}
- if (CRYPTO_atomic_add(&dso->references, 1, &i, dso->lock) <= 0)
+ if (CRYPTO_UP_REF(&dso->references, &i, dso->lock) <= 0)
return 0;
REF_PRINT_COUNT("DSO", r);
diff --git a/crypto/dso/dso_locl.h b/crypto/dso/dso_locl.h
index fbfad0544a..14a0ccb7c0 100644
--- a/crypto/dso/dso_locl.h
+++ b/crypto/dso/dso_locl.h
@@ -11,6 +11,7 @@
#include "internal/cryptlib.h"
#include "internal/dso.h"
#include "internal/dso_conf.h"
+#include "internal/refcount.h"
/**********************************************************************/
/* The low-level handle type used to refer to a loaded shared library */
@@ -24,7 +25,7 @@ struct dso_st {
* "Handles" and such go in a STACK.
*/
STACK_OF(void) *meth_data;
- int references;
+ CRYPTO_REF_COUNT references;
int flags;
/*
* For use by applications etc ... use this for your bits'n'pieces, don't