00001
00002
00003
00004
00005
00006 #ifndef xmog_atomic_pointer_inc
00007 #define xmog_atomic_pointer_inc
00008
00009
00010 #include "xmog.h"
00011
00012
00013
00014
00015 #if !((XMOG_WINDOWS == 1) || \
00016 (defined (__GNUC__) && defined (__i386)) \
00017 )
00018 # define XMOG_NEED_TO_EMULATE_ATOMIC
00019 #endif
00020
00021
00025 class XMOG_DECLSPEC xmog_atomic_pointer
00026 {
00027 public:
00028
00032 xmog_atomic_pointer() : value_( NULL ) {}
00033
00039 xmog_atomic_pointer( void * p ) : value_( p ) {}
00040
00047 xmog_atomic_pointer( const xmog_atomic_pointer & _rhs ) : value_( _rhs.value_ ) {}
00048
00052 void * value() const
00053 {
00054 return (void*)value_;
00055 }
00056
00062 int operator == ( void * _rhs ) const
00063 {
00064 return value_ == _rhs;
00065 }
00066
00072 int operator != ( void * _rhs ) const
00073 {
00074 return value_ != _rhs;
00075 }
00076
00082 xmog_atomic_pointer & operator = ( void * _rhs );
00083
00089 xmog_atomic_pointer & operator = ( xmog_atomic_pointer & _rhs );
00090
00091 private:
00092
00093 void * volatile value_;
00094 };
00095
00096
00097 #endif