Merge lp:~olafvdspek/drizzle/refactor11 into lp:~drizzle-trunk/drizzle/development
- refactor11
- Merge into development
Status: | Work in progress |
---|---|
Proposed branch: | lp:~olafvdspek/drizzle/refactor11 |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Diff against target: |
329 lines (+48/-100) 4 files modified
drizzled/atomic/gcc_traits.h (+0/-4) drizzled/atomic/pthread_traits.h (+0/-6) drizzled/atomics.h (+39/-53) unittests/pthread_atomics_test.cc (+9/-37) |
To merge this branch: | bzr merge lp:~olafvdspek/drizzle/refactor11 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Monty Taylor | Needs Information | ||
Review via email: mp+82055@code.launchpad.net |
Commit message
Description of the change
Monty Taylor (mordred) wrote : | # |
I would be interested in an explanation of what your refactor is doing in the atomic classes. I'm not saying that it's wrong, but the template code in there isn't exactly friendly, so I'd like to know what it is you're shooting for here.
Olaf van der Spek (olafvdspek) wrote : | # |
On Tue, Nov 15, 2011 at 7:48 PM, Monty Taylor <email address hidden> wrote:
> Review: Needs Information
>
> I would be interested in an explanation of what your refactor is doing in the atomic classes. I'm not saying that it's wrong, but the template code in there isn't exactly friendly, so I'd like to know what it is you're shooting for here.
I removed emptry constructors and destructors.
Moved atomic_base into atomic_impl.
Removed a type.
--
Olaf
Monty Taylor (mordred) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11/15/2011 05:04 PM, Olaf van der Spek wrote:
> On Tue, Nov 15, 2011 at 7:48 PM, Monty Taylor
> <email address hidden> wrote:
>> Review: Needs Information
>>
>> I would be interested in an explanation of what your refactor is
>> doing in the atomic classes. I'm not saying that it's wrong, but
>> the template code in there isn't exactly friendly, so I'd like to
>> know what it is you're shooting for here.
>
> I removed emptry constructors and destructors. Moved atomic_base
> into atomic_impl. Removed a type.
So - more specifically:
What are you accomplishing with the atomic_base -> atomic_impl move.
(not saying it's bad - I just want to know what you wanted to do here)
Why did you remove the empty constructors? They were preventing
default constructors from writing data to memory locations that we
didn't want them to write to?
Additionally - the pthread_
that the pthread-based atomic class worked, even if you happened to be
running the tests on a machine that happened to have real atomic
support. With the change to use the top-level atomic class, the test
no longer tests that.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAk7
T2gAnRewAHJ/
=aVWw
-----END PGP SIGNATURE-----
Olaf van der Spek (olafvdspek) wrote : | # |
On Tue, Nov 15, 2011 at 8:28 PM, Monty Taylor <email address hidden> wrote:
> What are you accomplishing with the atomic_base -> atomic_impl move.
> (not saying it's bad - I just want to know what you wanted to do here)
Simpler code.
> Why did you remove the empty constructors? They were preventing
> default constructors from writing data to memory locations that we
> didn't want them to write to?
Eh, to what memory would default constructors write?
> Additionally - the pthread_
> that the pthread-based atomic class worked, even if you happened to be
> running the tests on a machine that happened to have real atomic
> support. With the change to use the top-level atomic class, the test
> no longer tests that.
Ah. Does it make sense to test code you're not going to use though?
--
Olaf
Brian Aker (brianaker) wrote : | # |
@Olaf I'd leave the atomic implementation alone. This is an area where in the future someone could want what you are removing (and what has tests).
re: query_id
Right now it is one step closer to being encapsulated for catalogs, why remove that?
For if(), go on and put { } around what you expect it to execute. Over the years I've found just too many unintended bugs based on code getting shuffled, and no one realizing that the behavior of the branch had changed.
Olaf van der Spek (olafvdspek) wrote : | # |
On Wed, Nov 16, 2011 at 10:08 AM, Brian Aker <email address hidden> wrote:
> @Olaf I'd leave the atomic implementation alone. This is an area where in the future someone could want what you are removing (and what has tests).
I'll restore the tests to test the pthread implementation.
But what removed code could someone want in the future?
> re: query_id
> Right now it is one step closer to being encapsulated for catalogs, why remove that?
How does it relate to catalogs?
Olaf
- 2462. By Olaf van der Spek
-
Merge trunk
Olaf van der Spek (olafvdspek) wrote : | # |
On Tue, Nov 15, 2011 at 8:37 PM, Olaf van der Spek <email address hidden> wrote:
> On Tue, Nov 15, 2011 at 8:28 PM, Monty Taylor <email address hidden> wrote:
>> What are you accomplishing with the atomic_base -> atomic_impl move.
>> (not saying it's bad - I just want to know what you wanted to do here)
>
> Simpler code.
>
>> Why did you remove the empty constructors? They were preventing
>> default constructors from writing data to memory locations that we
>> didn't want them to write to?
>
> Eh, to what memory would default constructors write?
>
>> Additionally - the pthread_
>> that the pthread-based atomic class worked, even if you happened to be
>> running the tests on a machine that happened to have real atomic
>> support. With the change to use the top-level atomic class, the test
>> no longer tests that.
>
> Ah. Does it make sense to test code you're not going to use though?
Monty?
--
Olaf
- 2463. By Olaf van der Spek
-
Merge trunk
- 2464. By Olaf van der Spek
-
Merge trunk
Unmerged revisions
- 2464. By Olaf van der Spek
-
Merge trunk
- 2463. By Olaf van der Spek
-
Merge trunk
- 2462. By Olaf van der Spek
-
Merge trunk
- 2461. By Olaf van der Spek
-
Refactor
- 2460. By Olaf van der Spek
-
Refactor
- 2459. By Olaf van der Spek
-
Refactor
- 2458. By Olaf van der Spek
-
Refactor
Preview Diff
1 | === modified file 'drizzled/atomic/gcc_traits.h' | |||
2 | --- drizzled/atomic/gcc_traits.h 2011-03-14 05:40:28 +0000 | |||
3 | +++ drizzled/atomic/gcc_traits.h 2011-12-16 16:07:29 +0000 | |||
4 | @@ -25,12 +25,9 @@ | |||
5 | 25 | template<typename T, typename D> | 25 | template<typename T, typename D> |
6 | 26 | class gcc_traits | 26 | class gcc_traits |
7 | 27 | { | 27 | { |
8 | 28 | |||
9 | 29 | public: | 28 | public: |
10 | 30 | typedef T value_type; | 29 | typedef T value_type; |
11 | 31 | 30 | ||
12 | 32 | gcc_traits() {} | ||
13 | 33 | |||
14 | 34 | inline value_type add_and_fetch(volatile value_type *value, D addend ) | 31 | inline value_type add_and_fetch(volatile value_type *value, D addend ) |
15 | 35 | { | 32 | { |
16 | 36 | return __sync_add_and_fetch(value, addend); | 33 | return __sync_add_and_fetch(value, addend); |
17 | @@ -91,4 +88,3 @@ | |||
18 | 91 | 88 | ||
19 | 92 | } /* namespace internal */ | 89 | } /* namespace internal */ |
20 | 93 | } /* namespace drizzled */ | 90 | } /* namespace drizzled */ |
21 | 94 | |||
22 | 95 | 91 | ||
23 | === modified file 'drizzled/atomic/pthread_traits.h' | |||
24 | --- drizzled/atomic/pthread_traits.h 2011-03-14 05:40:28 +0000 | |||
25 | +++ drizzled/atomic/pthread_traits.h 2011-12-16 16:07:29 +0000 | |||
26 | @@ -21,7 +21,6 @@ | |||
27 | 21 | #pragma once | 21 | #pragma once |
28 | 22 | 22 | ||
29 | 23 | namespace drizzled { | 23 | namespace drizzled { |
30 | 24 | |||
31 | 25 | namespace internal { | 24 | namespace internal { |
32 | 26 | 25 | ||
33 | 27 | class mutex_wrapper | 26 | class mutex_wrapper |
34 | @@ -61,11 +60,8 @@ | |||
35 | 61 | mutex_wrapper my_lock; | 60 | mutex_wrapper my_lock; |
36 | 62 | 61 | ||
37 | 63 | public: | 62 | public: |
38 | 64 | |||
39 | 65 | typedef T value_type; | 63 | typedef T value_type; |
40 | 66 | 64 | ||
41 | 67 | pthread_traits() {} | ||
42 | 68 | |||
43 | 69 | inline value_type add_and_fetch(volatile value_type *value, D addend ) | 65 | inline value_type add_and_fetch(volatile value_type *value, D addend ) |
44 | 70 | { | 66 | { |
45 | 71 | my_lock.lock(); | 67 | my_lock.lock(); |
46 | @@ -147,5 +143,3 @@ | |||
47 | 147 | 143 | ||
48 | 148 | } /* namespace internal */ | 144 | } /* namespace internal */ |
49 | 149 | } /* namespace drizzled */ | 145 | } /* namespace drizzled */ |
50 | 150 | |||
51 | 151 | |||
52 | 152 | 146 | ||
53 | === modified file 'drizzled/atomics.h' | |||
54 | --- drizzled/atomics.h 2011-08-14 17:04:01 +0000 | |||
55 | +++ drizzled/atomics.h 2011-12-16 16:07:29 +0000 | |||
56 | @@ -38,80 +38,67 @@ | |||
57 | 38 | namespace drizzled { | 38 | namespace drizzled { |
58 | 39 | namespace internal { | 39 | namespace internal { |
59 | 40 | 40 | ||
69 | 41 | template<typename I> // Primary template | 41 | template<typename T, typename TR> |
70 | 42 | struct atomic_base { | 42 | class atomic_impl |
62 | 43 | volatile I my_value; | ||
63 | 44 | atomic_base() : my_value(0) {} | ||
64 | 45 | virtual ~atomic_base() {} | ||
65 | 46 | }; | ||
66 | 47 | |||
67 | 48 | template<typename I, typename D, typename T > | ||
68 | 49 | class atomic_impl: private atomic_base<I> | ||
71 | 50 | { | 43 | { |
73 | 51 | T traits; | 44 | TR traits; |
74 | 45 | volatile T my_value; | ||
75 | 52 | public: | 46 | public: |
81 | 53 | typedef I value_type; | 47 | typedef T value_type; |
82 | 54 | 48 | ||
83 | 55 | atomic_impl() : atomic_base<I>(), traits() {} | 49 | atomic_impl() : my_value(0) {} |
84 | 56 | 50 | ||
85 | 57 | value_type add_and_fetch( D addend ) | 51 | value_type add_and_fetch( T addend ) |
86 | 58 | { | 52 | { |
88 | 59 | return traits.add_and_fetch(&this->my_value, addend); | 53 | return traits.add_and_fetch(&my_value, addend); |
89 | 60 | } | 54 | } |
90 | 61 | 55 | ||
92 | 62 | value_type fetch_and_add( D addend ) | 56 | value_type fetch_and_add( T addend ) |
93 | 63 | { | 57 | { |
95 | 64 | return traits.fetch_and_add(&this->my_value, addend); | 58 | return traits.fetch_and_add(&my_value, addend); |
96 | 65 | } | 59 | } |
97 | 66 | 60 | ||
98 | 67 | value_type fetch_and_increment() | 61 | value_type fetch_and_increment() |
99 | 68 | { | 62 | { |
101 | 69 | return traits.fetch_and_increment(&this->my_value); | 63 | return traits.fetch_and_increment(&my_value); |
102 | 70 | } | 64 | } |
103 | 71 | 65 | ||
104 | 72 | value_type fetch_and_decrement() | 66 | value_type fetch_and_decrement() |
105 | 73 | { | 67 | { |
107 | 74 | return traits.fetch_and_decrement(&this->my_value); | 68 | return traits.fetch_and_decrement(&my_value); |
108 | 75 | } | 69 | } |
109 | 76 | 70 | ||
110 | 77 | value_type fetch_and_store( value_type value ) | 71 | value_type fetch_and_store( value_type value ) |
111 | 78 | { | 72 | { |
113 | 79 | return traits.fetch_and_store(&this->my_value, value); | 73 | return traits.fetch_and_store(&my_value, value); |
114 | 80 | } | 74 | } |
115 | 81 | 75 | ||
116 | 82 | bool compare_and_swap( value_type value, value_type comparand ) | 76 | bool compare_and_swap( value_type value, value_type comparand ) |
117 | 83 | { | 77 | { |
119 | 84 | return traits.compare_and_swap(&this->my_value, value, comparand); | 78 | return traits.compare_and_swap(&my_value, value, comparand); |
120 | 85 | } | 79 | } |
121 | 86 | 80 | ||
122 | 87 | operator value_type() const volatile | 81 | operator value_type() const volatile |
123 | 88 | { | 82 | { |
140 | 89 | return traits.fetch(&this->my_value); | 83 | return traits.fetch(&my_value); |
141 | 90 | } | 84 | } |
142 | 91 | 85 | ||
143 | 92 | value_type& _internal_reference() const | 86 | void store_with_release( value_type value ) |
144 | 93 | { | 87 | { |
145 | 94 | return this->my_value; | 88 | traits.store_with_release(&my_value, value); |
146 | 95 | } | 89 | } |
147 | 96 | 90 | ||
148 | 97 | protected: | 91 | atomic_impl& operator+=( T addend ) |
133 | 98 | value_type store_with_release( value_type rhs ) | ||
134 | 99 | { | ||
135 | 100 | return traits.store_with_release(&this->my_value, rhs); | ||
136 | 101 | } | ||
137 | 102 | |||
138 | 103 | public: | ||
139 | 104 | atomic_impl<I,D,T>& operator+=( D addend ) | ||
149 | 105 | { | 92 | { |
150 | 106 | increment(addend); | 93 | increment(addend); |
151 | 107 | return *this; | 94 | return *this; |
152 | 108 | } | 95 | } |
153 | 109 | 96 | ||
155 | 110 | atomic_impl<I,D,T>& operator-=( D addend ) | 97 | atomic_impl& operator-=( T addend ) |
156 | 111 | { | 98 | { |
157 | 112 | // Additive inverse of addend computed using binary minus, | 99 | // Additive inverse of addend computed using binary minus, |
158 | 113 | // instead of unary minus, for sake of avoiding compiler warnings. | 100 | // instead of unary minus, for sake of avoiding compiler warnings. |
160 | 114 | return operator+=(D(0)-addend); | 101 | return operator+=(T(0)-addend); |
161 | 115 | } | 102 | } |
162 | 116 | 103 | ||
163 | 117 | value_type increment() | 104 | value_type increment() |
164 | @@ -121,7 +108,7 @@ | |||
165 | 121 | 108 | ||
166 | 122 | value_type decrement() | 109 | value_type decrement() |
167 | 123 | { | 110 | { |
169 | 124 | return add_and_fetch(D(-1)); | 111 | return add_and_fetch(T(-1)); |
170 | 125 | } | 112 | } |
171 | 126 | }; | 113 | }; |
172 | 127 | 114 | ||
173 | @@ -131,15 +118,16 @@ | |||
174 | 131 | /** See the Reference for details. | 118 | /** See the Reference for details. |
175 | 132 | @ingroup synchronization */ | 119 | @ingroup synchronization */ |
176 | 133 | template<typename T> | 120 | template<typename T> |
178 | 134 | struct atomic { | 121 | struct atomic |
179 | 122 | { | ||
180 | 135 | }; | 123 | }; |
181 | 136 | 124 | ||
182 | 137 | /* *INDENT-OFF* */ | 125 | /* *INDENT-OFF* */ |
188 | 138 | #define __DRIZZLE_DECL_ATOMIC(T) \ | 126 | #define __DRIZZLE_DECL_ATOMIC(T) \ |
189 | 139 | template<> struct atomic<T> \ | 127 | template<> \ |
190 | 140 | : internal::atomic_impl<T,T,ATOMIC_TRAITS<T,T> > { \ | 128 | struct atomic<T> : internal::atomic_impl<T, ATOMIC_TRAITS<T, T> > \ |
191 | 141 | atomic<T>() : internal::atomic_impl<T,T,ATOMIC_TRAITS<T,T> >() {} \ | 129 | { \ |
192 | 142 | atomic<T>& operator=( T rhs ) { store_with_release(rhs); return *this; } \ | 130 | void operator=(T v) { store_with_release(v); } \ |
193 | 143 | }; | 131 | }; |
194 | 144 | /* *INDENT-ON* */ | 132 | /* *INDENT-ON* */ |
195 | 145 | 133 | ||
196 | @@ -164,11 +152,10 @@ | |||
197 | 164 | __DRIZZLE_DECL_ATOMIC(unsigned long long) | 152 | __DRIZZLE_DECL_ATOMIC(unsigned long long) |
198 | 165 | # else | 153 | # else |
199 | 166 | # define __DRIZZLE_DECL_ATOMIC64(T) \ | 154 | # define __DRIZZLE_DECL_ATOMIC64(T) \ |
205 | 167 | template<> struct atomic<T> \ | 155 | template<> \ |
206 | 168 | : internal::atomic_impl<T,T,internal::pthread_traits<T,T> > { \ | 156 | struct atomic<T> : internal::atomic_impl<T, internal::pthread_traits<T, T> > \ |
207 | 169 | atomic<T>() \ | 157 | { \ |
208 | 170 | : internal::atomic_impl<T,T,internal::pthread_traits<T,T> >() {} \ | 158 | void operator=(T v) { store_with_release(v); } \ |
204 | 171 | T operator=( T rhs ) { return store_with_release(rhs); } \ | ||
209 | 172 | }; | 159 | }; |
210 | 173 | __DRIZZLE_DECL_ATOMIC64(long long) | 160 | __DRIZZLE_DECL_ATOMIC64(long long) |
211 | 174 | __DRIZZLE_DECL_ATOMIC64(unsigned long long) | 161 | __DRIZZLE_DECL_ATOMIC64(unsigned long long) |
212 | @@ -176,4 +163,3 @@ | |||
213 | 176 | /* *INDENT-ON* */ | 163 | /* *INDENT-ON* */ |
214 | 177 | 164 | ||
215 | 178 | } | 165 | } |
216 | 179 | |||
217 | 180 | 166 | ||
218 | === modified file 'unittests/pthread_atomics_test.cc' | |||
219 | --- unittests/pthread_atomics_test.cc 2011-02-17 00:14:13 +0000 | |||
220 | +++ unittests/pthread_atomics_test.cc 2011-12-16 16:07:29 +0000 | |||
221 | @@ -21,44 +21,16 @@ | |||
222 | 21 | #include <config.h> | 21 | #include <config.h> |
223 | 22 | 22 | ||
224 | 23 | #define BOOST_TEST_DYN_LINK | 23 | #define BOOST_TEST_DYN_LINK |
225 | 24 | |||
226 | 24 | #include <boost/test/unit_test.hpp> | 25 | #include <boost/test/unit_test.hpp> |
227 | 25 | |||
228 | 26 | # if defined(__SUNPRO_CC) | ||
229 | 27 | # include <drizzled/atomic/sun_studio.h> | ||
230 | 28 | # endif | ||
231 | 29 | |||
232 | 30 | # if !defined(__ICC) && (defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(__SUNPRO_CC)) | ||
233 | 31 | # include <drizzled/atomic/gcc_traits.h> | ||
234 | 32 | # define ATOMIC_TRAITS internal::gcc_traits | ||
235 | 33 | # else /* use pthread impl */ | ||
236 | 34 | # define ATOMIC_TRAITS internal::pthread_traits | ||
237 | 35 | # endif | ||
238 | 36 | |||
239 | 37 | #include <pthread.h> | ||
240 | 38 | #include <drizzled/atomic/pthread_traits.h> | ||
241 | 39 | |||
242 | 40 | #include <drizzled/atomics.h> | 26 | #include <drizzled/atomics.h> |
243 | 41 | 27 | ||
244 | 42 | using namespace drizzled; | 28 | using namespace drizzled; |
245 | 43 | 29 | ||
246 | 44 | template<typename T> | ||
247 | 45 | struct atomic_pthread { | ||
248 | 46 | }; | ||
249 | 47 | |||
250 | 48 | # define __DRIZZLE_DECL_ATOMIC_PTHREAD(T) \ | ||
251 | 49 | template<> struct atomic_pthread<T> \ | ||
252 | 50 | : internal::atomic_impl<T,T, internal::pthread_traits<T,T> > { \ | ||
253 | 51 | atomic_pthread<T>() \ | ||
254 | 52 | : internal::atomic_impl<T,T, internal::pthread_traits<T,T> >() {} \ | ||
255 | 53 | T operator=( T rhs ) { return store_with_release(rhs); } \ | ||
256 | 54 | }; | ||
257 | 55 | |||
258 | 56 | __DRIZZLE_DECL_ATOMIC_PTHREAD(unsigned int) | ||
259 | 57 | |||
260 | 58 | BOOST_AUTO_TEST_SUITE(PthreadAtomicOperations) | 30 | BOOST_AUTO_TEST_SUITE(PthreadAtomicOperations) |
261 | 59 | BOOST_AUTO_TEST_CASE(fetch_and_store) | 31 | BOOST_AUTO_TEST_CASE(fetch_and_store) |
262 | 60 | { | 32 | { |
264 | 61 | atomic_pthread<uint32_t> u235; | 33 | atomic<uint32_t> u235; |
265 | 62 | 34 | ||
266 | 63 | BOOST_REQUIRE_EQUAL(0, u235.fetch_and_store(1)); | 35 | BOOST_REQUIRE_EQUAL(0, u235.fetch_and_store(1)); |
267 | 64 | 36 | ||
268 | @@ -70,7 +42,7 @@ | |||
269 | 70 | 42 | ||
270 | 71 | BOOST_AUTO_TEST_CASE(fetch_and_increment) | 43 | BOOST_AUTO_TEST_CASE(fetch_and_increment) |
271 | 72 | { | 44 | { |
273 | 73 | atomic_pthread<uint32_t> u235; | 45 | atomic<uint32_t> u235; |
274 | 74 | 46 | ||
275 | 75 | BOOST_REQUIRE_EQUAL(0, u235.fetch_and_increment()); | 47 | BOOST_REQUIRE_EQUAL(0, u235.fetch_and_increment()); |
276 | 76 | BOOST_REQUIRE_EQUAL(1, u235); | 48 | BOOST_REQUIRE_EQUAL(1, u235); |
277 | @@ -78,7 +50,7 @@ | |||
278 | 78 | 50 | ||
279 | 79 | BOOST_AUTO_TEST_CASE(fetch_and_add) | 51 | BOOST_AUTO_TEST_CASE(fetch_and_add) |
280 | 80 | { | 52 | { |
282 | 81 | atomic_pthread<uint32_t> u235; | 53 | atomic<uint32_t> u235; |
283 | 82 | 54 | ||
284 | 83 | BOOST_REQUIRE_EQUAL(0, u235.fetch_and_add(2)); | 55 | BOOST_REQUIRE_EQUAL(0, u235.fetch_and_add(2)); |
285 | 84 | BOOST_REQUIRE_EQUAL(2, u235); | 56 | BOOST_REQUIRE_EQUAL(2, u235); |
286 | @@ -86,7 +58,7 @@ | |||
287 | 86 | 58 | ||
288 | 87 | BOOST_AUTO_TEST_CASE(add_and_fetch) | 59 | BOOST_AUTO_TEST_CASE(add_and_fetch) |
289 | 88 | { | 60 | { |
291 | 89 | atomic_pthread<uint32_t> u235; | 61 | atomic<uint32_t> u235; |
292 | 90 | 62 | ||
293 | 91 | BOOST_REQUIRE_EQUAL(10, u235.add_and_fetch(10)); | 63 | BOOST_REQUIRE_EQUAL(10, u235.add_and_fetch(10)); |
294 | 92 | BOOST_REQUIRE_EQUAL(10, u235); | 64 | BOOST_REQUIRE_EQUAL(10, u235); |
295 | @@ -94,7 +66,7 @@ | |||
296 | 94 | 66 | ||
297 | 95 | BOOST_AUTO_TEST_CASE(fetch_and_decrement) | 67 | BOOST_AUTO_TEST_CASE(fetch_and_decrement) |
298 | 96 | { | 68 | { |
300 | 97 | atomic_pthread<uint32_t> u235; | 69 | atomic<uint32_t> u235; |
301 | 98 | 70 | ||
302 | 99 | u235.fetch_and_store(15); | 71 | u235.fetch_and_store(15); |
303 | 100 | 72 | ||
304 | @@ -104,7 +76,7 @@ | |||
305 | 104 | 76 | ||
306 | 105 | BOOST_AUTO_TEST_CASE(compare_and_swap) | 77 | BOOST_AUTO_TEST_CASE(compare_and_swap) |
307 | 106 | { | 78 | { |
309 | 107 | atomic_pthread<uint32_t> u235; | 79 | atomic<uint32_t> u235; |
310 | 108 | 80 | ||
311 | 109 | u235.fetch_and_store(100); | 81 | u235.fetch_and_store(100); |
312 | 110 | 82 | ||
313 | @@ -115,14 +87,14 @@ | |||
314 | 115 | 87 | ||
315 | 116 | BOOST_AUTO_TEST_CASE(increment) | 88 | BOOST_AUTO_TEST_CASE(increment) |
316 | 117 | { | 89 | { |
318 | 118 | atomic_pthread<uint32_t> u235; | 90 | atomic<uint32_t> u235; |
319 | 119 | u235.fetch_and_store(200); | 91 | u235.fetch_and_store(200); |
320 | 120 | BOOST_REQUIRE_EQUAL(201, u235.increment()); | 92 | BOOST_REQUIRE_EQUAL(201, u235.increment()); |
321 | 121 | } | 93 | } |
322 | 122 | 94 | ||
323 | 123 | BOOST_AUTO_TEST_CASE(decrement) | 95 | BOOST_AUTO_TEST_CASE(decrement) |
324 | 124 | { | 96 | { |
326 | 125 | atomic_pthread<uint32_t> u235; | 97 | atomic<uint32_t> u235; |
327 | 126 | u235.fetch_and_store(200); | 98 | u235.fetch_and_store(200); |
328 | 127 | 99 | ||
329 | 128 | BOOST_REQUIRE_EQUAL(199, u235.decrement()); | 100 | BOOST_REQUIRE_EQUAL(199, u235.decrement()); |
Hi. Touching the atomics and the trait constructors needs to be reviewed by Brian. I'm asking him to review this before merging.