/* -*- C++ -*- */ // Guard_T.inl,v 4.2 2003/11/01 11:15:12 dhinton Exp #include "ace/RW_Thread_Mutex.h" template ACE_INLINE int ACE_Guard::acquire (void) { return this->owner_ = this->lock_->acquire (); } template ACE_INLINE int ACE_Guard::tryacquire (void) { return this->owner_ = this->lock_->tryacquire (); } template ACE_INLINE int ACE_Guard::release (void) { if (this->owner_ == -1) return -1; else { this->owner_ = -1; return this->lock_->release (); } } template ACE_INLINE ACE_Guard::ACE_Guard (ACE_LOCK &l) : lock_ (&l), owner_ (0) { this->acquire (); } template ACE_INLINE ACE_Guard::ACE_Guard (ACE_LOCK &l, int block) : lock_ (&l), owner_ (0) { if (block) this->acquire (); else this->tryacquire (); } template ACE_INLINE ACE_Guard::ACE_Guard (ACE_LOCK &l, int block, int become_owner) : lock_ (&l), owner_ (become_owner == 0 ? -1 : 0) { ACE_UNUSED_ARG (block); } // Implicitly and automatically acquire (or try to acquire) the // lock. template ACE_INLINE ACE_Guard::~ACE_Guard (void) { this->release (); } template ACE_INLINE int ACE_Guard::locked (void) const { return this->owner_ != -1; } template ACE_INLINE int ACE_Guard::remove (void) { return this->lock_->remove (); } template ACE_INLINE void ACE_Guard::disown (void) { this->owner_ = -1; } template ACE_INLINE ACE_Write_Guard::ACE_Write_Guard (ACE_LOCK &m) : ACE_Guard (&m) { this->acquire_write (); } template ACE_INLINE int ACE_Write_Guard::acquire_write (void) { return this->owner_ = this->lock_->acquire_write (); } template ACE_INLINE int ACE_Write_Guard::acquire (void) { return this->owner_ = this->lock_->acquire_write (); } template ACE_INLINE int ACE_Write_Guard::tryacquire_write (void) { return this->owner_ = this->lock_->tryacquire_write (); } template ACE_INLINE int ACE_Write_Guard::tryacquire (void) { return this->owner_ = this->lock_->tryacquire_write (); } template ACE_INLINE ACE_Write_Guard::ACE_Write_Guard (ACE_LOCK &m, int block) : ACE_Guard (&m) { if (block) this->acquire_write (); else this->tryacquire_write (); } template ACE_INLINE int ACE_Read_Guard::acquire_read (void) { return this->owner_ = this->lock_->acquire_read (); } template ACE_INLINE int ACE_Read_Guard::acquire (void) { return this->owner_ = this->lock_->acquire_read (); } template ACE_INLINE int ACE_Read_Guard::tryacquire_read (void) { return this->owner_ = this->lock_->tryacquire_read (); } template ACE_INLINE int ACE_Read_Guard::tryacquire (void) { return this->owner_ = this->lock_->tryacquire_read (); } template ACE_INLINE ACE_Read_Guard::ACE_Read_Guard (ACE_LOCK &m) : ACE_Guard (&m) { this->acquire_read (); } template ACE_INLINE ACE_Read_Guard::ACE_Read_Guard (ACE_LOCK &m, int block) : ACE_Guard (&m) { if (block) this->acquire_read (); else this->tryacquire_read (); }