diff options
Diffstat (limited to 'debian/patches/0002-include-add-lock-less-reference-counting-primitives.patch')
-rw-r--r-- | debian/patches/0002-include-add-lock-less-reference-counting-primitives.patch | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/debian/patches/0002-include-add-lock-less-reference-counting-primitives.patch b/debian/patches/0002-include-add-lock-less-reference-counting-primitives.patch index 145d340e..6718ab31 100644 --- a/debian/patches/0002-include-add-lock-less-reference-counting-primitives.patch +++ b/debian/patches/0002-include-add-lock-less-reference-counting-primitives.patch @@ -1,20 +1,20 @@ -From 8faea20349dc1d8cfd0117d28a3f1271083192d0 Mon Sep 17 00:00:00 2001 +From 55ddd1b28a57492c5df4afcdf167910fb7bbc3a1 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 2/5] include: add lock-less reference counting primitives +Subject: [PATCH 02/11] include: add lock-less reference counting primitives * include/refcount.h: New file. --- - include/refcount.h | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 155 insertions(+) + include/refcount.h | 174 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 174 insertions(+) create mode 100644 include/refcount.h diff --git a/include/refcount.h b/include/refcount.h new file mode 100644 -index 0000000..946938a +index 0000000..0a9ed8e --- /dev/null +++ b/include/refcount.h -@@ -0,0 +1,155 @@ +@@ -0,0 +1,174 @@ +/* Lock-less reference counting primitives + + Copyright (C) 2014 Free Software Foundation, Inc. @@ -44,31 +44,36 @@ index 0000000..946938a +/* Simple reference counting. */ + +/* An opaque type. You must not access these values directly. */ -+typedef uint32_t refcount_t; ++typedef unsigned int refcount_t; + +/* Initialize REF with REFERENCES. */ +static inline void -+refcount_init (refcount_t *ref, uint32_t references) ++refcount_init (refcount_t *ref, unsigned int references) +{ + *ref = references; +} + -+/* Increment REF. Return the result of the operation. */ -+static inline uint32_t ++/* Increment REF. Return the result of the operation. This function ++ uses atomic operations. It is not required to serialize calls to ++ this function. */ ++static inline unsigned int +refcount_ref (refcount_t *ref) +{ + return __atomic_add_fetch (ref, 1, __ATOMIC_RELAXED); +} + -+/* Decrement REF. Return the result of the operation. */ -+static inline uint32_t ++/* Decrement REF. Return the result of the operation. This function ++ uses atomic operations. It is not required to serialize calls to ++ this function. */ ++static inline unsigned int +refcount_deref (refcount_t *ref) +{ + return __atomic_sub_fetch (ref, 1, __ATOMIC_RELAXED); +} + -+/* Return REF. */ -+static inline uint32_t ++/* Return REF. This function uses atomic operations. It is not ++ required to serialize calls to this function. */ ++static inline unsigned int +refcount_references (refcount_t *ref) +{ + return __atomic_load_n (ref, __ATOMIC_RELAXED); @@ -100,7 +105,9 @@ index 0000000..946938a +} + +/* Increment the hard reference count of REF. If RESULT is not NULL, -+ the result of the operation is written there. */ ++ the result of the operation is written there. This function uses ++ atomic operations. It is not required to serialize calls to this ++ function. */ +static inline void +refcounts_ref (refcounts_t *ref, struct references *result) +{ @@ -111,7 +118,9 @@ index 0000000..946938a +} + +/* Decrement the hard reference count of REF. If RESULT is not NULL, -+ the result of the operation is written there. */ ++ the result of the operation is written there. This function uses ++ atomic operations. It is not required to serialize calls to this ++ function. */ +static inline void +refcounts_deref (refcounts_t *ref, struct references *result) +{ @@ -122,7 +131,9 @@ index 0000000..946938a +} + +/* Increment the weak reference count of REF. If RESULT is not NULL, -+ the result of the operation is written there. */ ++ the result of the operation is written there. This function uses ++ atomic operations. It is not required to serialize calls to this ++ function. */ +static inline void +refcounts_ref_weak (refcounts_t *ref, struct references *result) +{ @@ -133,7 +144,9 @@ index 0000000..946938a +} + +/* Decrement the weak reference count of REF. If RESULT is not NULL, -+ the result of the operation is written there. */ ++ the result of the operation is written there. This function uses ++ atomic operations. It is not required to serialize calls to this ++ function. */ +static inline void +refcounts_deref_weak (refcounts_t *ref, struct references *result) +{ @@ -143,7 +156,9 @@ index 0000000..946938a + ((union _references *) result)->rc = r; +} + -+/* Store the current reference counts of REF in RESULT. */ ++/* Store the current reference counts of REF in RESULT. This function ++ uses atomic operations. It is not required to serialize calls to ++ this function. */ +static inline void +refcounts_references (refcounts_t *ref, struct references *result) +{ @@ -151,7 +166,9 @@ index 0000000..946938a + __atomic_load_n (ref, __ATOMIC_RELAXED); +} + -+/* Return the hard reference count of REF. */ ++/* Return the hard reference count of REF. This function uses atomic ++ operations. It is not required to serialize calls to this ++ function. */ +static inline uint32_t +refcounts_hard_references (refcounts_t *ref) +{ @@ -160,7 +177,9 @@ index 0000000..946938a + return result.hard; +} + -+/* Return the weak reference count of REF. */ ++/* Return the weak reference count of REF. This function uses atomic ++ operations. It is not required to serialize calls to this ++ function. */ +static inline uint32_t +refcounts_weak_references (refcounts_t *ref) +{ |