summaryrefslogtreecommitdiff
path: root/debian/patches/0001-include-add-lock-less-reference-counting-primitives.patch
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-06 21:59:01 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2014-05-06 21:59:01 +0200
commitf781e8ead80409cd61256d8cb8464538e4801661 (patch)
tree2ca64273b1b5762b31d85c5d1934c8a77e8081c6 /debian/patches/0001-include-add-lock-less-reference-counting-primitives.patch
parentfa85aba08e005ba948a52b7bc1ac815366c6c84f (diff)
refresh the new lockless refcount patches
Diffstat (limited to 'debian/patches/0001-include-add-lock-less-reference-counting-primitives.patch')
-rw-r--r--debian/patches/0001-include-add-lock-less-reference-counting-primitives.patch49
1 files changed, 32 insertions, 17 deletions
diff --git a/debian/patches/0001-include-add-lock-less-reference-counting-primitives.patch b/debian/patches/0001-include-add-lock-less-reference-counting-primitives.patch
index 426813a7..0ee3897e 100644
--- a/debian/patches/0001-include-add-lock-less-reference-counting-primitives.patch
+++ b/debian/patches/0001-include-add-lock-less-reference-counting-primitives.patch
@@ -1,20 +1,20 @@
-From 2fdfbfae579a84a00bcca2f4888e716ef0bb7578 Mon Sep 17 00:00:00 2001
+From 6c60761119510bd019c2214eb80fd7fd244e29cd Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Tue, 6 May 2014 19:52:04 +0200
Subject: [PATCH 1/4] include: add lock-less reference counting primitives
* include/refcount.h: New file.
---
- include/refcount.h | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 132 insertions(+)
+ include/refcount.h | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 147 insertions(+)
create mode 100644 include/refcount.h
diff --git a/include/refcount.h b/include/refcount.h
new file mode 100644
-index 0000000..6e20342
+index 0000000..b90cc5b
--- /dev/null
+++ b/include/refcount.h
-@@ -0,0 +1,132 @@
+@@ -0,0 +1,147 @@
+/* Lock-less reference counting primitives
+
+ Copyright (C) 2014 Free Software Foundation, Inc.
@@ -47,36 +47,40 @@ index 0000000..6e20342
+typedef uint32_t refcount_t;
+
+/* Initialize REF with REFERENCES. */
-+extern inline void
++static inline void
+refcount_init (refcount_t *ref, uint32_t references)
+{
+ *ref = references;
+}
+
+/* Increment REF. Return the result of the operation. */
-+extern inline uint32_t
++static inline uint32_t
+refcount_ref (refcount_t *ref)
+{
+ return __atomic_add_fetch (ref, 1, __ATOMIC_RELAXED);
+}
+
+/* Decrement REF. Return the result of the operation. */
-+extern inline uint32_t
++static inline uint32_t
+refcount_deref (refcount_t *ref)
+{
+ return __atomic_sub_fetch (ref, 1, __ATOMIC_RELAXED);
+}
+
+/* Return REF. */
-+extern inline uint32_t
++static inline uint32_t
+refcount_references (refcount_t *ref)
+{
+ return __atomic_load_n (ref, __ATOMIC_RELAXED);
+}
++
++/* Reference counting with weak references. */
+
-+
++/* An opaque type. You must not access these values directly. */
+typedef uint64_t refcounts_t;
+
++/* Instead, the functions manipulating refcounts_t values write the
++ results into this kind of objects. */
+struct references {
+ uint32_t hard;
+ uint32_t weak;
@@ -87,14 +91,17 @@ index 0000000..6e20342
+ refcounts_t rc;
+};
+
-+extern inline void
++/* Initialize REF with HARD and WEAK references. */
++static inline void
+refcounts_init (refcounts_t *ref, uint32_t hard, uint32_t weak)
+{
+ ((union _references *) ref)->refs =
+ (struct references) { .hard = hard, .weak = weak };
+}
+
-+extern inline void
++/* Increment the hard reference count of REF. If RESULT is not NULL,
++ the result of the operation is written there. */
++static inline void
+refcounts_ref (refcounts_t *ref, struct references *result)
+{
+ const union _references op = { .refs = { .hard = 1 } };
@@ -103,7 +110,9 @@ index 0000000..6e20342
+ ((union _references *) result)->rc = r;
+}
+
-+extern inline void
++/* Decrement the hard reference count of REF. If RESULT is not NULL,
++ the result of the operation is written there. */
++static inline void
+refcounts_deref (refcounts_t *ref, struct references *result)
+{
+ const union _references op = { .refs = { .hard = 1 } };
@@ -112,7 +121,9 @@ index 0000000..6e20342
+ ((union _references *) result)->rc = r;
+}
+
-+extern inline void
++/* Increment the weak reference count of REF. If RESULT is not NULL,
++ the result of the operation is written there. */
++static inline void
+refcounts_ref_weak (refcounts_t *ref, struct references *result)
+{
+ const union _references op = { .refs = { .weak = 1 } };
@@ -121,7 +132,9 @@ index 0000000..6e20342
+ ((union _references *) result)->rc = r;
+}
+
-+extern inline void
++/* Decrement the weak reference count of REF. If RESULT is not NULL,
++ the result of the operation is written there. */
++static inline void
+refcounts_deref_weak (refcounts_t *ref, struct references *result)
+{
+ const union _references op = { .refs = { .weak = 1 } };
@@ -130,7 +143,8 @@ index 0000000..6e20342
+ ((union _references *) result)->rc = r;
+}
+
-+extern inline uint32_t
++/* Return the hard reference count of REF. */
++static inline uint32_t
+refcounts_hard_references (refcounts_t *ref)
+{
+ union _references result;
@@ -138,7 +152,8 @@ index 0000000..6e20342
+ return result.refs.hard;
+}
+
-+extern inline uint32_t
++/* Return the weak reference count of REF. */
++static inline uint32_t
+refcounts_weak_references (refcounts_t *ref)
+{
+ union _references result;