View | Details | Raw Unified | Return to bug 50731
Collapse All | Expand All

(-)atomic/win32/apr_atomic.c (-2 / +2 lines)
Lines 118-124 Link Here
118
#endif
118
#endif
119
}
119
}
120
120
121
APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
121
APR_DECLARE(void *) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp)
122
{
122
{
123
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
123
#if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED)
124
    return InterlockedCompareExchangePointer((void* volatile*)mem, with, (void*)cmp);
124
    return InterlockedCompareExchangePointer((void* volatile*)mem, with, (void*)cmp);
Lines 141-147 Link Here
141
#endif
141
#endif
142
}
142
}
143
143
144
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
144
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with)
145
{
145
{
146
#if (defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(RC_INVOKED)
146
#if (defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(RC_INVOKED)
147
    return InterlockedExchangePointer((void**)mem, with);
147
    return InterlockedExchangePointer((void**)mem, with);
(-)atomic/unix/ia32.c (-2 / +2 lines)
Lines 89-95 Link Here
89
    return prev;
89
    return prev;
90
}
90
}
91
91
92
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
92
APR_DECLARE(void*) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp)
93
{
93
{
94
    void *prev;
94
    void *prev;
95
#if APR_SIZEOF_VOIDP == 4
95
#if APR_SIZEOF_VOIDP == 4
Lines 107-113 Link Here
107
    return prev;
107
    return prev;
108
}
108
}
109
109
110
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
110
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with)
111
{
111
{
112
    void *prev;
112
    void *prev;
113
#if APR_SIZEOF_VOIDP == 4
113
#if APR_SIZEOF_VOIDP == 4
(-)atomic/unix/s390.c (-2 / +2 lines)
Lines 110-116 Link Here
110
    return prev;
110
    return prev;
111
}
111
}
112
112
113
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
113
APR_DECLARE(void*) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp)
114
{
114
{
115
    void *prev = (void *) cmp;
115
    void *prev = (void *) cmp;
116
#if APR_SIZEOF_VOIDP == 4
116
#if APR_SIZEOF_VOIDP == 4
Lines 129-135 Link Here
129
    return prev;
129
    return prev;
130
}
130
}
131
131
132
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
132
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with)
133
{
133
{
134
    void *prev = (void *) *mem;
134
    void *prev = (void *) *mem;
135
#if APR_SIZEOF_VOIDP == 4
135
#if APR_SIZEOF_VOIDP == 4
(-)atomic/unix/mutex.c (-2 / +2 lines)
Lines 174-180 Link Here
174
    return prev;
174
    return prev;
175
}
175
}
176
176
177
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
177
APR_DECLARE(void*) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp)
178
{
178
{
179
    void *prev;
179
    void *prev;
180
    DECLARE_MUTEX_LOCKED(mutex, *mem);
180
    DECLARE_MUTEX_LOCKED(mutex, *mem);
Lines 189-195 Link Here
189
    return prev;
189
    return prev;
190
}
190
}
191
191
192
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
192
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with)
193
{
193
{
194
    void *prev;
194
    void *prev;
195
    DECLARE_MUTEX_LOCKED(mutex, *mem);
195
    DECLARE_MUTEX_LOCKED(mutex, *mem);
(-)atomic/unix/ppc.c (-2 / +2 lines)
Lines 142-148 Link Here
142
    return prev;
142
    return prev;
143
}
143
}
144
144
145
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
145
APR_DECLARE(void*) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp)
146
{
146
{
147
    void *prev;
147
    void *prev;
148
#if APR_SIZEOF_VOIDP == 4
148
#if APR_SIZEOF_VOIDP == 4
Lines 175-181 Link Here
175
    return prev;
175
    return prev;
176
}
176
}
177
177
178
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
178
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with)
179
{
179
{
180
    void *prev;
180
    void *prev;
181
#if APR_SIZEOF_VOIDP == 4
181
#if APR_SIZEOF_VOIDP == 4
(-)atomic/unix/builtins.c (-2 / +2 lines)
Lines 66-77 Link Here
66
    return __sync_lock_test_and_set(mem, val);
66
    return __sync_lock_test_and_set(mem, val);
67
}
67
}
68
68
69
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
69
APR_DECLARE(void*) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp)
70
{
70
{
71
    return (void*) __sync_val_compare_and_swap(mem, cmp, with);
71
    return (void*) __sync_val_compare_and_swap(mem, cmp, with);
72
}
72
}
73
73
74
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
74
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with)
75
{
75
{
76
    __sync_synchronize();
76
    __sync_synchronize();
77
77
(-)atomic/unix/solaris.c (-2 / +2 lines)
Lines 66-77 Link Here
66
    return atomic_swap_32(mem, val);
66
    return atomic_swap_32(mem, val);
67
}
67
}
68
68
69
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
69
APR_DECLARE(void*) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp)
70
{
70
{
71
    return atomic_cas_ptr(mem, (void*) cmp, with);
71
    return atomic_cas_ptr(mem, (void*) cmp, with);
72
}
72
}
73
73
74
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
74
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with)
75
{
75
{
76
    return atomic_swap_ptr(mem, with);
76
    return atomic_swap_ptr(mem, with);
77
}
77
}
(-)atomic/netware/apr_atomic.c (-2 / +2 lines)
Lines 64-75 Link Here
64
    return (atomic_xchgadd((unsigned long *)mem, 0xFFFFFFFF) - 1);
64
    return (atomic_xchgadd((unsigned long *)mem, 0xFFFFFFFF) - 1);
65
}
65
}
66
66
67
APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
67
APR_DECLARE(void *) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp)
68
{
68
{
69
    return (void*)atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with);
69
    return (void*)atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with);
70
}
70
}
71
71
72
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
72
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with)
73
{
73
{
74
    return (void*)atomic_xchg((unsigned long *)mem,(unsigned long)with);
74
    return (void*)atomic_xchg((unsigned long *)mem,(unsigned long)with);
75
}
75
}
(-)atomic/os390/atomic.c (-3 / +3 lines)
Lines 83-89 Link Here
83
}
83
}
84
84
85
#if APR_SIZEOF_VOIDP == 4
85
#if APR_SIZEOF_VOIDP == 4
86
void *apr_atomic_casptr(volatile void **mem_ptr,
86
void *apr_atomic_casptr(void * volatile *mem_ptr,
87
                        void *swap_ptr,
87
                        void *swap_ptr,
88
                        const void *cmp_ptr)
88
                        const void *cmp_ptr)
89
{
89
{
Lines 93-99 Link Here
93
     return (void *)cmp_ptr;
93
     return (void *)cmp_ptr;
94
}
94
}
95
#elif APR_SIZEOF_VOIDP == 8
95
#elif APR_SIZEOF_VOIDP == 8
96
void *apr_atomic_casptr(volatile void **mem_ptr,
96
void *apr_atomic_casptr(void * volatile *mem_ptr,
97
                        void *swap_ptr,
97
                        void *swap_ptr,
98
                        const void *cmp_ptr)
98
                        const void *cmp_ptr)
99
{
99
{
Lines 118-124 Link Here
118
    return old;
118
    return old;
119
}
119
}
120
120
121
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem_ptr, void *new_ptr)
121
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem_ptr, void *new_ptr)
122
{
122
{
123
    void *old_ptr;
123
    void *old_ptr;
124
124
(-)test/testatomic.c (-4 / +4 lines)
Lines 84-90 Link Here
84
static void test_xchgptr(abts_case *tc, void *data)
84
static void test_xchgptr(abts_case *tc, void *data)
85
{
85
{
86
    int a;
86
    int a;
87
    volatile void *target_ptr = NULL;
87
    void * volatile target_ptr = NULL;
88
    void *old_ptr;
88
    void *old_ptr;
89
89
90
    old_ptr = apr_atomic_xchgptr(&target_ptr, &a);
90
    old_ptr = apr_atomic_xchgptr(&target_ptr, &a);
Lines 125-131 Link Here
125
static void test_casptr_equal(abts_case *tc, void *data)
125
static void test_casptr_equal(abts_case *tc, void *data)
126
{
126
{
127
    int a;
127
    int a;
128
    volatile void *target_ptr = NULL;
128
    void * volatile target_ptr = NULL;
129
    void *old_ptr;
129
    void *old_ptr;
130
130
131
    old_ptr = apr_atomic_casptr(&target_ptr, &a, NULL);
131
    old_ptr = apr_atomic_casptr(&target_ptr, &a, NULL);
Lines 136-142 Link Here
136
static void test_casptr_equal_nonnull(abts_case *tc, void *data)
136
static void test_casptr_equal_nonnull(abts_case *tc, void *data)
137
{
137
{
138
    int a, b;
138
    int a, b;
139
    volatile void *target_ptr = &a;
139
    void * volatile target_ptr = &a;
140
    void *old_ptr;
140
    void *old_ptr;
141
141
142
    old_ptr = apr_atomic_casptr(&target_ptr, &b, &a);
142
    old_ptr = apr_atomic_casptr(&target_ptr, &b, &a);
Lines 147-153 Link Here
147
static void test_casptr_notequal(abts_case *tc, void *data)
147
static void test_casptr_notequal(abts_case *tc, void *data)
148
{
148
{
149
    int a, b;
149
    int a, b;
150
    volatile void *target_ptr = &a;
150
    void * volatile target_ptr = &a;
151
    void *old_ptr;
151
    void *old_ptr;
152
152
153
    old_ptr = apr_atomic_casptr(&target_ptr, &a, &b);
153
    old_ptr = apr_atomic_casptr(&target_ptr, &a, &b);
(-)include/apr_atomic.h (-2 / +2 lines)
Lines 121-127 Link Here
121
 * @param cmp the value to compare it to
121
 * @param cmp the value to compare it to
122
 * @return the old value of the pointer
122
 * @return the old value of the pointer
123
 */
123
 */
124
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp);
124
APR_DECLARE(void*) apr_atomic_casptr(void * volatile *mem, void *with, const void *cmp);
125
125
126
/**
126
/**
127
 * exchange a pair of pointer values
127
 * exchange a pair of pointer values
Lines 129-135 Link Here
129
 * @param with what to swap it with
129
 * @param with what to swap it with
130
 * @return the old value of the pointer
130
 * @return the old value of the pointer
131
 */
131
 */
132
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with);
132
APR_DECLARE(void*) apr_atomic_xchgptr(void * volatile *mem, void *with);
133
133
134
/** @} */
134
/** @} */
135
135

Return to bug 50731