aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/utils/utils.c')
-rw-r--r--src/libstrongswan/utils/utils.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libstrongswan/utils/utils.c b/src/libstrongswan/utils/utils.c
index fe80edb82..e4da6ddb9 100644
--- a/src/libstrongswan/utils/utils.c
+++ b/src/libstrongswan/utils/utils.c
@@ -528,7 +528,6 @@ refcount_t ref_get(refcount_t *ref)
pthread_mutex_lock(&ref_mutex);
current = ++(*ref);
pthread_mutex_unlock(&ref_mutex);
-
return current;
}
@@ -546,6 +545,19 @@ bool ref_put(refcount_t *ref)
}
/**
+ * Current refcount
+ */
+refcount_t ref_cur(refcount_t *ref)
+{
+ refcount_t current;
+
+ pthread_mutex_lock(&ref_mutex);
+ current = *ref;
+ pthread_mutex_unlock(&ref_mutex);
+ return current;
+}
+
+/**
* Single mutex for all compare and swap operations.
*/
static pthread_mutex_t cas_mutex = PTHREAD_MUTEX_INITIALIZER;