// -*- C++ -*- // // $Id$ #include "ace/Guard_T.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL // // ACE_Atomic_Op_Ex inline functions // template ACE_INLINE TYPE ACE_Atomic_Op_Ex::operator++ (void) { // 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+= (const 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-- (void) { // 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-= (const 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 (const ACE_Atomic_Op_Ex &rhs) : mutex_ (rhs.mutex_) { // ACE_TRACE ("ACE_Atomic_Op_Ex::ACE_Atomic_Op_Ex"); *this = rhs; // Invoke the assignment operator. } 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== (const TYPE &rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator=="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); return this->value_ == rhs; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator!= (const TYPE &rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator!="); return !(*this == rhs); } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator>= (const TYPE &rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator>="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); return this->value_ >= rhs; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator> (const TYPE &rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator>"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); return this->value_ > rhs; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator<= (const TYPE &rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator<="); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); return this->value_ <= rhs; } template ACE_INLINE bool ACE_Atomic_Op_Ex::operator< (const TYPE &rhs) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator<"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, false); return this->value_ < rhs; } template ACE_INLINE ACE_Atomic_Op_Ex & ACE_Atomic_Op_Ex::operator= (const ACE_Atomic_Op_Ex &rhs) { // ACE_TRACE ("ACE_Atomic_Op_Ex::operator="); if (&rhs == this) return *this; // Avoid deadlock... ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, *this); // This will call ACE_Atomic_Op_Ex::TYPE(), which will ensure the // value of is acquired atomically. this->value_ = rhs.value (); return *this; } template ACE_INLINE TYPE ACE_Atomic_Op_Ex::value (void) const { // ACE_TRACE ("ACE_Atomic_Op_Ex::value"); ACE_GUARD_RETURN (ACE_LOCK, ace_mon, (ACE_LOCK &) this->mutex_, this->value_); return this->value_; } template ACE_INLINE TYPE & ACE_Atomic_Op_Ex::value_i (void) { // 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= (const 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 (const ACE_Atomic_Op &rhs) : impl_ (this->own_mutex_, rhs.value ()) { // ACE_TRACE ("ACE_Atomic_Op::ACE_Atomic_Op"); } template ACE_INLINE ACE_Atomic_Op & ACE_Atomic_Op::operator= (const TYPE &i) { this->impl_ = i; return *this; } template ACE_INLINE ACE_Atomic_Op & ACE_Atomic_Op::operator= (const ACE_Atomic_Op &rhs) { this->impl_ = rhs.impl_; return *this; } template ACE_INLINE TYPE ACE_Atomic_Op::operator++ (void) { return ++this->impl_; } template ACE_INLINE TYPE ACE_Atomic_Op::operator++ (int) { return this->impl_++; } template ACE_INLINE TYPE ACE_Atomic_Op::operator+= (const TYPE &rhs) { return this->impl_ += rhs; } template ACE_INLINE TYPE ACE_Atomic_Op::operator-- (void) { return --this->impl_; } template ACE_INLINE TYPE ACE_Atomic_Op::operator-- (int) { return this->impl_--; } template ACE_INLINE TYPE ACE_Atomic_Op::operator-= (const TYPE &rhs) { return this->impl_ -= rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator== (const TYPE &rhs) const { return this->impl_ == rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator!= (const TYPE &rhs) const { return this->impl_ != rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator>= (const TYPE &rhs) const { return this->impl_ >= rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator> (const TYPE &rhs) const { return this->impl_ > rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator<= (const TYPE &rhs) const { return this->impl_ <= rhs; } template ACE_INLINE bool ACE_Atomic_Op::operator< (const TYPE &rhs) const { return this->impl_ < rhs; } template ACE_INLINE TYPE ACE_Atomic_Op::value (void) const { return this->impl_.value (); } template ACE_INLINE void ACE_Atomic_Op::dump (void) const { #if defined (ACE_HAS_DUMP) this->impl_.dump (); #endif /* ACE_HAS_DUMP */ return; } template ACE_INLINE ACE_LOCK & ACE_Atomic_Op::mutex (void) { return this->own_mutex_; } template ACE_INLINE TYPE & ACE_Atomic_Op::value_i (void) { return this->impl_.value_i (); } ACE_END_VERSIONED_NAMESPACE_DECL