diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-28 21:29:01 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-28 21:29:01 +0000 |
commit | 39aed2b4132f514626d7c88d5a3d5157f0734c3f (patch) | |
tree | 01bdcbfbe828f8115a3ca01fcb83869558116193 /ace/Synch_T.i | |
parent | 0dec820e27210f5867c031e70bedc4277f97db52 (diff) | |
download | ATCD-39aed2b4132f514626d7c88d5a3d5157f0734c3f.tar.gz |
ChangeLogTag: Sat Aug 28 16:28:33 1999 David L. Levine <levine@cs.wustl.edu>
Diffstat (limited to 'ace/Synch_T.i')
-rw-r--r-- | ace/Synch_T.i | 118 |
1 files changed, 58 insertions, 60 deletions
diff --git a/ace/Synch_T.i b/ace/Synch_T.i index 2a14fd7a399..8a7105033cf 100644 --- a/ace/Synch_T.i +++ b/ace/Synch_T.i @@ -1,10 +1,32 @@ /* -*- C++ -*- */ // $Id$ -// Synch_T.i - #include "ace/Thread.h" +template <class ACE_LOCK> ACE_INLINE int +ACE_Guard<ACE_LOCK>::acquire (void) +{ + return this->owner_ = this->lock_->acquire (); +} + +template <class ACE_LOCK> ACE_INLINE int +ACE_Guard<ACE_LOCK>::tryacquire (void) +{ + return this->owner_ = this->lock_->tryacquire (); +} + +template <class ACE_LOCK> ACE_INLINE int +ACE_Guard<ACE_LOCK>::release (void) +{ + if (this->owner_ != -1) + { + this->owner_ = -1; + return this->lock_->release (); + } + else + return 0; +} + template <class ACE_LOCK> ACE_INLINE ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l) : lock_ (&l), @@ -34,46 +56,46 @@ ACE_Guard<ACE_LOCK>::~ACE_Guard (void) } template <class ACE_LOCK> ACE_INLINE int -ACE_Guard<ACE_LOCK>::acquire (void) +ACE_Guard<ACE_LOCK>::locked (void) { - return this->owner_ = this->lock_->acquire (); + return this->owner_ != -1; } template <class ACE_LOCK> ACE_INLINE int -ACE_Guard<ACE_LOCK>::tryacquire (void) +ACE_Guard<ACE_LOCK>::remove (void) { - return this->owner_ = this->lock_->tryacquire (); + return this->lock_->remove (); +} + +template <class ACE_LOCK> ACE_INLINE +ACE_Write_Guard<ACE_LOCK>::ACE_Write_Guard (ACE_LOCK &m) + : ACE_Guard<ACE_LOCK> (&m) +{ + this->acquire_write (); } template <class ACE_LOCK> ACE_INLINE int -ACE_Guard<ACE_LOCK>::release (void) +ACE_Write_Guard<ACE_LOCK>::acquire_write (void) { - if (this->owner_ != -1) - { - this->owner_ = -1; - return this->lock_->release (); - } - else - return 0; + return this->owner_ = this->lock_->acquire_write (); } template <class ACE_LOCK> ACE_INLINE int -ACE_Guard<ACE_LOCK>::locked (void) +ACE_Write_Guard<ACE_LOCK>::acquire (void) { - return this->owner_ != -1; + return this->owner_ = this->lock_->acquire_write (); } template <class ACE_LOCK> ACE_INLINE int -ACE_Guard<ACE_LOCK>::remove (void) +ACE_Write_Guard<ACE_LOCK>::tryacquire_write (void) { - return this->lock_->remove (); + return this->owner_ = this->lock_->tryacquire_write (); } -template <class ACE_LOCK> ACE_INLINE -ACE_Write_Guard<ACE_LOCK>::ACE_Write_Guard (ACE_LOCK &m) - : ACE_Guard<ACE_LOCK> (&m) +template <class ACE_LOCK> ACE_INLINE int +ACE_Write_Guard<ACE_LOCK>::tryacquire (void) { - this->acquire_write (); + return this->owner_ = this->lock_->tryacquire_write (); } template <class ACE_LOCK> ACE_INLINE @@ -88,38 +110,38 @@ ACE_Write_Guard<ACE_LOCK>::ACE_Write_Guard (ACE_LOCK &m, } template <class ACE_LOCK> ACE_INLINE int -ACE_Write_Guard<ACE_LOCK>::acquire_write (void) +ACE_Read_Guard<ACE_LOCK>::acquire_read (void) { - return this->owner_ = this->lock_->acquire_write (); + return this->owner_ = this->lock_->acquire_read (); } -template <class ACE_LOCK> ACE_INLINE int -ACE_Write_Guard<ACE_LOCK>::acquire (void) +template <class ACE_LOCK> ACE_INLINE int +ACE_Read_Guard<ACE_LOCK>::acquire (void) { - return this->owner_ = this->lock_->acquire_write (); + return this->owner_ = this->lock_->acquire_read (); } -template <class ACE_LOCK> ACE_INLINE int -ACE_Write_Guard<ACE_LOCK>::tryacquire_write (void) +template <class ACE_LOCK> ACE_INLINE int +ACE_Read_Guard<ACE_LOCK>::tryacquire_read (void) { - return this->owner_ = this->lock_->tryacquire_write (); + return this->owner_ = this->lock_->tryacquire_read (); } -template <class ACE_LOCK> ACE_INLINE int -ACE_Write_Guard<ACE_LOCK>::tryacquire (void) +template <class ACE_LOCK> ACE_INLINE int +ACE_Read_Guard<ACE_LOCK>::tryacquire (void) { - return this->owner_ = this->lock_->tryacquire_write (); + return this->owner_ = this->lock_->tryacquire_read (); } -template <class ACE_LOCK> ACE_INLINE +template <class ACE_LOCK> ACE_INLINE ACE_Read_Guard<ACE_LOCK>::ACE_Read_Guard (ACE_LOCK &m) : ACE_Guard<ACE_LOCK> (&m) { this->acquire_read (); } -template <class ACE_LOCK> ACE_INLINE -ACE_Read_Guard<ACE_LOCK>::ACE_Read_Guard (ACE_LOCK &m, +template <class ACE_LOCK> ACE_INLINE +ACE_Read_Guard<ACE_LOCK>::ACE_Read_Guard (ACE_LOCK &m, int block) : ACE_Guard<ACE_LOCK> (&m) { @@ -129,30 +151,6 @@ ACE_Read_Guard<ACE_LOCK>::ACE_Read_Guard (ACE_LOCK &m, this->tryacquire_read (); } -template <class ACE_LOCK> ACE_INLINE int -ACE_Read_Guard<ACE_LOCK>::acquire_read (void) -{ - return this->owner_ = this->lock_->acquire_read (); -} - -template <class ACE_LOCK> ACE_INLINE int -ACE_Read_Guard<ACE_LOCK>::acquire (void) -{ - return this->owner_ = this->lock_->acquire_read (); -} - -template <class ACE_LOCK> ACE_INLINE int -ACE_Read_Guard<ACE_LOCK>::tryacquire_read (void) -{ - return this->owner_ = this->lock_->tryacquire_read (); -} - -template <class ACE_LOCK> ACE_INLINE int -ACE_Read_Guard<ACE_LOCK>::tryacquire (void) -{ - return this->owner_ = this->lock_->tryacquire_read (); -} - template <class ACE_LOCKING_MECHANISM> ACE_INLINE ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter (ACE_LOCKING_MECHANISM &lock) : lock_ (&lock), |