summaryrefslogtreecommitdiff
path: root/ace/Synch_T.i
diff options
context:
space:
mode:
Diffstat (limited to 'ace/Synch_T.i')
-rw-r--r--ace/Synch_T.i102
1 files changed, 88 insertions, 14 deletions
diff --git a/ace/Synch_T.i b/ace/Synch_T.i
index cb190580243..2a14fd7a399 100644
--- a/ace/Synch_T.i
+++ b/ace/Synch_T.i
@@ -7,14 +7,16 @@
template <class ACE_LOCK> ACE_INLINE
ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l)
- : lock_ (&l), owner_ (0)
+ : lock_ (&l),
+ owner_ (0)
{
this->acquire ();
}
template <class ACE_LOCK> ACE_INLINE
ACE_Guard<ACE_LOCK>::ACE_Guard (ACE_LOCK &l, int block)
- : lock_ (&l), owner_ (0)
+ : lock_ (&l),
+ owner_ (0)
{
if (block)
this->acquire ();
@@ -31,24 +33,18 @@ ACE_Guard<ACE_LOCK>::~ACE_Guard (void)
this->release ();
}
-// Implicitly release the lock.
-
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::acquire (void)
{
return this->owner_ = this->lock_->acquire ();
}
-// Explicitly acquire the lock.
-
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::tryacquire (void)
{
return this->owner_ = this->lock_->tryacquire ();
}
-// Conditionally acquire the lock (i.e., won't block).
-
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::release (void)
{
@@ -61,23 +57,101 @@ ACE_Guard<ACE_LOCK>::release (void)
return 0;
}
-// Explicitly release the lock, but only if it is held!
-
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::locked (void)
{
return this->owner_ != -1;
}
-// 1 if locked, 0 if couldn't acquire the lock
-// (errno will contain the reason for this).
-
template <class ACE_LOCK> ACE_INLINE int
ACE_Guard<ACE_LOCK>::remove (void)
{
return this->lock_->remove ();
}
-// Explicitly remove the lock.
+
+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
+ACE_Write_Guard<ACE_LOCK>::ACE_Write_Guard (ACE_LOCK &m,
+ int block)
+ : ACE_Guard<ACE_LOCK> (&m)
+{
+ if (block)
+ this->acquire_write ();
+ else
+ this->tryacquire_write ();
+}
+
+template <class ACE_LOCK> ACE_INLINE int
+ACE_Write_Guard<ACE_LOCK>::acquire_write (void)
+{
+ return this->owner_ = this->lock_->acquire_write ();
+}
+
+template <class ACE_LOCK> ACE_INLINE int
+ACE_Write_Guard<ACE_LOCK>::acquire (void)
+{
+ return this->owner_ = this->lock_->acquire_write ();
+}
+
+template <class ACE_LOCK> ACE_INLINE int
+ACE_Write_Guard<ACE_LOCK>::tryacquire_write (void)
+{
+ return this->owner_ = this->lock_->tryacquire_write ();
+}
+
+template <class ACE_LOCK> ACE_INLINE int
+ACE_Write_Guard<ACE_LOCK>::tryacquire (void)
+{
+ return this->owner_ = this->lock_->tryacquire_write ();
+}
+
+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,
+ int block)
+ : ACE_Guard<ACE_LOCK> (&m)
+{
+ if (block)
+ this->acquire_read ();
+ else
+ 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)