Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-29 23:41:39 +0400
committerRussell Belfer <rb@github.com>2013-07-10 23:14:13 +0400
commit302a04b09ca706eeda9b8cceb50694f37973e348 (patch)
treed1a0199a8989ec1e727510145a929e69cc58eaf1
parente807860fa9b5278932a0ba25f84b4035b0ebda84 (diff)
Add accessors for refcount value
-rw-r--r--src/thread-utils.h5
-rw-r--r--src/util.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/thread-utils.h b/src/thread-utils.h
index f19a2ba2c..f8c4dc66d 100644
--- a/src/thread-utils.h
+++ b/src/thread-utils.h
@@ -43,6 +43,11 @@ GIT_INLINE(void) git_atomic_set(git_atomic *a, int val)
a->val = val;
}
+GIT_INLINE(int) git_atomic_get(git_atomic *a)
+{
+ return (int)a->val;
+}
+
#ifdef GIT_THREADS
#define git_thread pthread_t
diff --git a/src/util.h b/src/util.h
index e0088399c..a97c9bf39 100644
--- a/src/util.h
+++ b/src/util.h
@@ -221,6 +221,9 @@ typedef void (*git_refcount_freeptr)(void *r);
#define GIT_REFCOUNT_OWNER(r) (((git_refcount *)(r))->owner)
+#define GIT_REFCOUNT_VAL(r) git_atomic_get(&((git_refcount *)(r))->refcount)
+
+
static signed char from_hex[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 00 */
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 10 */