]> git.pld-linux.org Git - packages/db5.3.git/blob - db5.3-atomic_compare_exchange.patch
- don't load rpm macros manually
[packages/db5.3.git] / db5.3-atomic_compare_exchange.patch
1 diff -ur db-5.3.28.orig/src/dbinc/atomic.h db-5.3.28/src/dbinc/atomic.h
2 --- db-5.3.28.orig/src/dbinc/atomic.h   2013-09-09 17:35:08.000000000 +0200
3 +++ db-5.3.28/src/dbinc/atomic.h        2020-10-29 19:09:22.546238669 +0100
4 @@ -25,7 +25,7 @@
5   *      atomic_dec(env, valueptr)
6   *         Subtracts 1 from the db_atomic_t value, returning the new value.
7   *
8 - *      atomic_compare_exchange(env, valueptr, oldval, newval)
9 + *      atomic_compare_exchange_db(env, valueptr, oldval, newval)
10   *         If the db_atomic_t's value is still oldval, set it to newval.
11   *         It returns 1 for success or 0 for failure.
12   *
13 @@ -115,12 +115,12 @@
14         (WINCE_ATOMIC_MAGIC(p),                                         \
15         InterlockedDecrement((interlocked_val)(&(p)->value)))
16  #if defined(_MSC_VER) && _MSC_VER < 1300
17 -#define        atomic_compare_exchange(env, p, oldval, newval)                 \
18 +#define        atomic_compare_exchange_db(env, p, oldval, newval)                      \
19         (WINCE_ATOMIC_MAGIC(p),                                         \
20         (InterlockedCompareExchange((PVOID *)(&(p)->value),             \
21         (PVOID)(newval), (PVOID)(oldval)) == (PVOID)(oldval)))
22  #else
23 -#define        atomic_compare_exchange(env, p, oldval, newval)                 \
24 +#define        atomic_compare_exchange_db(env, p, oldval, newval)                      \
25         (WINCE_ATOMIC_MAGIC(p),                                         \
26         (InterlockedCompareExchange((interlocked_val)(&(p)->value),     \
27         (newval), (oldval)) == (oldval)))
28 @@ -134,7 +134,7 @@
29         atomic_inc_uint_nv((volatile unsigned int *) &(p)->value)
30  #define        atomic_dec(env, p)      \
31         atomic_dec_uint_nv((volatile unsigned int *) &(p)->value)
32 -#define        atomic_compare_exchange(env, p, oval, nval)             \
33 +#define        atomic_compare_exchange_db(env, p, oval, nval)          \
34         (atomic_cas_32((volatile unsigned int *) &(p)->value,   \
35             (oval), (nval)) == (oval))
36  #endif
37 @@ -143,8 +143,8 @@
38  /* x86/x86_64 gcc  */
39  #define        atomic_inc(env, p)      __atomic_inc(p)
40  #define        atomic_dec(env, p)      __atomic_dec(p)
41 -#define        atomic_compare_exchange(env, p, o, n)   \
42 -       __atomic_compare_exchange((p), (o), (n))
43 +#define        atomic_compare_exchange_db(env, p, o, n)        \
44 +       __atomic_compare_exchange_db((p), (o), (n))
45  static inline int __atomic_inc(db_atomic_t *p)
46  {
47         int     temp;
48 @@ -176,7 +176,7 @@
49   * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
50   * which configure could be changed to use.
51   */
52 -static inline int __atomic_compare_exchange(
53 +static inline int __atomic_compare_exchange_db(
54         db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
55  {
56         atomic_value_t was;
57 @@ -204,7 +204,7 @@
58   */
59  #define        atomic_inc(env, p)      (++(p)->value)
60  #define        atomic_dec(env, p)      (--(p)->value)
61 -#define        atomic_compare_exchange(env, p, oldval, newval)         \
62 +#define        atomic_compare_exchange_db(env, p, oldval, newval)              \
63         (DB_ASSERT(env, atomic_read(p) == (oldval)),            \
64         atomic_init(p, (newval)), 1)
65  #else
66 diff -ur db-5.3.28.orig/src/dbinc/mutex_int.h db-5.3.28/src/dbinc/mutex_int.h
67 --- db-5.3.28.orig/src/dbinc/mutex_int.h        2013-09-09 17:35:08.000000000 +0200
68 +++ db-5.3.28/src/dbinc/mutex_int.h     2020-10-29 19:09:29.846238669 +0100
69 @@ -1050,7 +1050,7 @@
70   */
71  #define        MUTEXP_ACQUIRE(mutexp)  \
72         (F_ISSET(mutexp, DB_MUTEX_SHARED) ?                     \
73 -       atomic_compare_exchange(env,                            \
74 +       atomic_compare_exchange_db(env,                         \
75             &(mutexp)->sharecount, 0, MUTEX_SHARE_ISEXCLUSIVE) :        \
76         MUTEX_SET(&(mutexp)->tas))
77  #else
78 diff -ur db-5.3.28.orig/src/dbinc_auto/int_def.in db-5.3.28/src/dbinc_auto/int_def.in
79 --- db-5.3.28.orig/src/dbinc_auto/int_def.in    2013-09-09 17:35:08.000000000 +0200
80 +++ db-5.3.28/src/dbinc_auto/int_def.in 2020-10-29 19:09:56.642238669 +0100
81 @@ -1488,7 +1488,7 @@
82  #define        __atomic_dec __atomic_dec@DB_VERSION_UNIQUE_NAME@
83  #endif
84  #if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT)
85 -#define        atomic_compare_exchange atomic_compare_exchange@DB_VERSION_UNIQUE_NAME@
86 +#define        atomic_compare_exchange_db atomic_compare_exchange_db@DB_VERSION_UNIQUE_NAME@
87  #endif
88  #define        __db_pthread_mutex_init __db_pthread_mutex_init@DB_VERSION_UNIQUE_NAME@
89  #ifndef HAVE_MUTEX_HYBRID
90 diff -ur db-5.3.28.orig/src/dbinc_auto/mutex_ext.h db-5.3.28/src/dbinc_auto/mutex_ext.h
91 --- db-5.3.28.orig/src/dbinc_auto/mutex_ext.h   2013-09-09 17:35:08.000000000 +0200
92 +++ db-5.3.28/src/dbinc_auto/mutex_ext.h        2020-10-29 19:10:00.649238669 +0100
93 @@ -38,7 +38,7 @@
94  atomic_value_t __atomic_dec __P((ENV *, db_atomic_t *));
95  #endif
96  #if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT)
97 -int atomic_compare_exchange __P((ENV *, db_atomic_t *, atomic_value_t, atomic_value_t));
98 +int atomic_compare_exchange_db __P((ENV *, db_atomic_t *, atomic_value_t, atomic_value_t));
99  #endif
100  int __db_pthread_mutex_init __P((ENV *, db_mutex_t, u_int32_t));
101  #ifndef HAVE_MUTEX_HYBRID
102 diff -ur db-5.3.28.orig/src/mutex/mut_method.c db-5.3.28/src/mutex/mut_method.c
103 --- db-5.3.28.orig/src/mutex/mut_method.c       2013-09-09 17:35:09.000000000 +0200
104 +++ db-5.3.28/src/mutex/mut_method.c    2020-10-29 19:09:45.172238669 +0100
105 @@ -445,11 +445,11 @@
106  }
107  
108  /*
109 - * atomic_compare_exchange
110 + * atomic_compare_exchange_db
111   *     Use a mutex to provide an atomic decrement function
112   *
113   * PUBLIC: #if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT)
114 - * PUBLIC: int atomic_compare_exchange
115 + * PUBLIC: int atomic_compare_exchange_db
116   * PUBLIC:     __P((ENV *, db_atomic_t *, atomic_value_t, atomic_value_t));
117   * PUBLIC: #endif
118   *     Returns 1 if the *v was equal to oldval, else 0
119 @@ -458,7 +458,7 @@
120   *             Sets the value to newval if and only if returning 1
121   */
122  int
123 -atomic_compare_exchange(env, v, oldval, newval)
124 +atomic_compare_exchange_db(env, v, oldval, newval)
125         ENV *env;
126         db_atomic_t *v;
127         atomic_value_t oldval;
128 diff -ur db-5.3.28.orig/src/mutex/mut_tas.c db-5.3.28/src/mutex/mut_tas.c
129 --- db-5.3.28.orig/src/mutex/mut_tas.c  2013-09-09 17:35:09.000000000 +0200
130 +++ db-5.3.28/src/mutex/mut_tas.c       2020-10-29 19:09:40.046238669 +0100
131 @@ -366,7 +366,7 @@
132             mtxregion->stat.st_mutex_tas_spins; nspins > 0; --nspins) {
133                 lock = atomic_read(&mutexp->sharecount);
134                 if (lock == MUTEX_SHARE_ISEXCLUSIVE ||
135 -                   !atomic_compare_exchange(env,
136 +                   !atomic_compare_exchange_db(env,
137                         &mutexp->sharecount, lock, lock + 1)) {
138                         /*
139                          * Some systems (notably those with newer Intel CPUs)
140 diff -ur db-5.3.28.orig/src/mutex/mut_win32.c db-5.3.28/src/mutex/mut_win32.c
141 --- db-5.3.28.orig/src/mutex/mut_win32.c        2013-09-09 17:35:09.000000000 +0200
142 +++ db-5.3.28/src/mutex/mut_win32.c     2020-10-29 19:09:51.148238669 +0100
143 @@ -361,7 +361,7 @@
144                                 return (DB_LOCK_NOTGRANTED);
145  
146                         continue;
147 -               } else if (!atomic_compare_exchange(env, &mutexp->sharecount,
148 +               } else if (!atomic_compare_exchange_db(env, &mutexp->sharecount,
149                     mtx_val, mtx_val + 1)) {
150                         /*
151                          * Some systems (notably those with newer Intel CPUs)
This page took 0.082968 seconds and 3 git commands to generate.