~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/atomics.h

  • Committer: Monty Taylor
  • Date: 2009-03-30 07:05:18 UTC
  • mto: (971.1.10 mordred)
  • mto: This revision was merged to the branch mainline in revision 970.
  • Revision ID: mordred@inaugust.com-20090330070518-mmxr1gl1hbeowe0a
Build fix making 64-bit atomic<> work on 32-bit systems.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#  include <drizzled/atomic/gcc_traits.h>
33
33
#  define ATOMIC_TRAITS internal::gcc_traits
34
34
# else  /* use pthread impl */
35
 
#  include <pthread.h>
36
 
#  include <drizzled/atomic/pthread_traits.h>
37
35
#  define ATOMIC_TRAITS internal::pthread_traits
38
36
# endif
39
37
 
 
38
# include <pthread.h>
 
39
# include <drizzled/atomic/pthread_traits.h>
 
40
 
40
41
 
41
42
namespace tbb {
42
43
 
144
145
    T operator=( T rhs ) { return store_with_release(rhs); }            \
145
146
  };
146
147
 
147
 
__TBB_DECL_ATOMIC(long long)
148
 
__TBB_DECL_ATOMIC(unsigned long long)
 
148
 
149
149
__TBB_DECL_ATOMIC(long)
150
150
__TBB_DECL_ATOMIC(unsigned long)
151
151
__TBB_DECL_ATOMIC(unsigned int)
156
156
__TBB_DECL_ATOMIC(signed char)
157
157
__TBB_DECL_ATOMIC(unsigned char)
158
158
 
 
159
/* 32-bit platforms don't have a GCC atomic operation for 64-bit types,
 
160
 * so we'll use pthread locks to handler 64-bit types on that platforms
 
161
 */
 
162
#  if SIZEOF_SIZE_T >= SIZEOF_LONG_LONG
 
163
__TBB_DECL_ATOMIC(long long)
 
164
__TBB_DECL_ATOMIC(unsigned long long)
 
165
#  else
 
166
#   define __TBB_DECL_ATOMIC64(T)                                            \
 
167
  template<> struct atomic<T>                                           \
 
168
  : internal::atomic_impl<T,T,internal::pthread_traits<T,T> > {                    \
 
169
    atomic<T>() : internal::atomic_impl<T,T,internal::pthread_traits<T,T> >() {}   \
 
170
    T operator=( T rhs ) { return store_with_release(rhs); }            \
 
171
  };
 
172
__TBB_DECL_ATOMIC64(long long)
 
173
__TBB_DECL_ATOMIC64(unsigned long long)
 
174
#  endif
 
175
 
159
176
}
160
 
#endif /* defined(HAVE_LIBTBB) */
 
177
# endif /* defined(HAVE_LIBTBB) */
161
178
 
162
179
#endif /* DRIZZLED_ATOMIC_H */