// -*- C++ -*- #include "ace/Guard_T.h" #include ACE_BEGIN_VERSIONED_NAMESPACE_DECL // // ACE_Atomic_Op_Ex inline functions // template ACE_INLINE TYPE ACE_Atomic_Op_Ex::operator++ () { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator++"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return ++this->value_; } template ACE_INLINE TYPE ACE_Atomic_Op_Ex::operator+= ( typename ACE_Atomic_Op_Ex::arg_type rhs) { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator+="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_ += rhs; } template ACE_INLINE TYPE ACE_Atomic_Op_Ex::operator-- () { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator--"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return --this->value_; } template ACE_INLINE TYPE ACE_Atomic_Op_Ex::operator-= ( typename ACE_Atomic_Op_Ex::arg_type rhs) { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator-="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_ -= rhs; } template ACE_INLINE ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex ( ACE_Atomic_Op_Ex const & rhs) : mutex_ (rhs.mutex_) , value_ (rhs.value ()) // rhs.value() returns atomically { // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); } template ACE_INLINE TYPE ACE_Atomic_Op_Ex::operator++ (int) { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator++"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_++; } template ACE_INLINE TYPE ACE_Atomic_Op_Ex::operator-- (int) { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator--"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_--; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator== ( typename ACE_Atomic_Op_Ex::arg_type rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator=="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); return this->value_ == rhs; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator!= ( typename ACE_Atomic_Op_Ex::arg_type rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator!="); return !(*this == rhs); } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator>= ( typename ACE_Atomic_Op_Ex::arg_type rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator>="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); return this->value_ >= rhs; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator> ( typename ACE_Atomic_Op_Ex::arg_type rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator>"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); return this->value_ > rhs; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator<= ( typename ACE_Atomic_Op_Ex::arg_type rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator<="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); return this->value_ <= rhs; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator< ( typename ACE_Atomic_Op_Ex::arg_type rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator<"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, false); return this->value_ < rhs; } template ACE_INLINE ACE_Atomic_Op_Ex & ACE_Atomic_Op_Ex::operator= ( ACE_Atomic_Op_Ex const & rhs) { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); ACE_Atomic_Op_Ex tmp (rhs); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); std::swap (this->value_, tmp.value_); return *this; } template ACE_INLINE TYPE ACE_Atomic_Op_Ex::exchange (TYPE newval) { // ACE_TRACE ("ACE_Atomic_Op_Ex::exchange"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); std::swap (this->value_, newval); return newval; } template ACE_INLINE TYPE ACE_Atomic_Op_Ex::value () const { // ACE_TRACE ("ACE_Atomic_Op_Ex::value"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, this->value_); return this->value_; } template ACE_INLINE TYPE & ACE_Atomic_Op_Ex::value_i () { // Explicitly return (by reference). This gives the user // full, unrestricted access to the underlying value. This method // will usually be used in conjunction with explicit access to the // lock. Use with care ;-) return this->value_; } template ACE_INLINE ACE_Atomic_Op_Ex & ACE_Atomic_Op_Ex::operator= ( typename ACE_Atomic_Op_Ex::arg_type rhs) { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); this->value_ = rhs; return *this; } // // ACE_Atomic_Op inline functions // template ACE_INLINE ACE_Atomic_Op::ACE_Atomic_Op ( ACE_Atomic_Op const & rhs) : impl_ (own_mutex_, rhs.value ()) { // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); } template ACE_INLINE ACE_Atomic_Op & ACE_Atomic_Op::operator= ( typename ACE_Atomic_Op::arg_type i) { this->impl_ = i; return *this; } template ACE_INLINE ACE_Atomic_Op & ACE_Atomic_Op::operator= ( ACE_Atomic_Op const & rhs) { this->impl_ = rhs.impl_; return *this; } template ACE_INLINE TYPE ACE_Atomic_Op::operator++ () { return ++this->impl_; } template ACE_INLINE TYPE ACE_Atomic_Op::operator++ (int) { return this->impl_++; } template ACE_INLINE TYPE ACE_Atomic_Op::operator+= ( typename ACE_Atomic_Op::arg_type rhs) { return this->impl_ += rhs; } template ACE_INLINE TYPE ACE_Atomic_Op::operator-- () { return --this->impl_; } template ACE_INLINE TYPE ACE_Atomic_Op::operator-- (int) { return this->impl_--; } template ACE_INLINE TYPE ACE_Atomic_Op::operator-= ( typename ACE_Atomic_Op::arg_type rhs) { return this->impl_ -= rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator== ( typename ACE_Atomic_Op::arg_type rhs) const { return this->impl_ == rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator!= ( typename ACE_Atomic_Op::arg_type rhs) const { return this->impl_ != rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator>= ( typename ACE_Atomic_Op::arg_type rhs) const { return this->impl_ >= rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator> ( typename ACE_Atomic_Op::arg_type rhs) const { return this->impl_ > rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator<= ( typename ACE_Atomic_Op::arg_type rhs) const { return this->impl_ <= rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator< ( typename ACE_Atomic_Op::arg_type rhs) const { return this->impl_ < rhs; } template ACE_INLINE TYPE ACE_Atomic_Op::exchange (TYPE newval) { return this->impl_.exchange (newval); } template ACE_INLINE TYPE ACE_Atomic_Op::value () const { return this->impl_.value (); } template ACE_INLINE void ACE_Atomic_Op::dump () const { #if defined (ACE_HAS_DUMP) this->impl_.dump (); #endif /* ACE_HAS_DUMP */ return; } template ACE_INLINE TYPE & ACE_Atomic_Op::value_i () { return this->impl_.value_i (); } ACE_END_VERSIONED_NAMESPACE_DECL