diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-01 08:00:34 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-01 08:00:34 +0000 |
commit | ea0d28240863caf437a18071bfd03e7b146c5ade (patch) | |
tree | 91b695852b885a5f44f9be8c3a22bbf7f5a96b8d /ace/Synch_T.h | |
parent | a6e2ced2f5279e011b712995095a1712a29e22f0 (diff) | |
download | ATCD-ea0d28240863caf437a18071bfd03e7b146c5ade.tar.gz |
foo
Diffstat (limited to 'ace/Synch_T.h')
-rw-r--r-- | ace/Synch_T.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ace/Synch_T.h b/ace/Synch_T.h index 167bf36950a..ee3ab76422e 100644 --- a/ace/Synch_T.h +++ b/ace/Synch_T.h @@ -23,6 +23,57 @@ // Forward decl class ACE_Time_Value; +template <class LOCKING_MECHANISM> +class ACE_Lock_Adapter : public ACE_Lock + // = TITLE + + // This is an adapter that allows applications to transparently + // combine the <ACE_Lock> abstract base class (which contains + // pure virtual methods) with any of the other concrete ACE + // synchronization classes (e.g., <ACE_Mutex>, <ACE_Semaphore>, + // <ACE_RW_Lock>, etc.). + // + // = DESCRIPTION + // This class uses a form of the Adapter pattern. +{ +public: + typedef LOCKING_MECHANISM LOCK; + + virtual int remove (void); + // Explicitly destroy the lock. + + virtual int acquire (void); + // Block the thread until the lock is acquired. + + virtual int tryacquire (void); + // Conditionally acquire the lock (i.e., won't block). + + virtual int release (void); + // Release the lock. + + virtual int acquire_read (void); + // Block until the thread acquires a read lock. If the locking + // mechanism doesn't support read locks then this just calls + // <acquire>. + + virtual int acquire_write (void); + // Block until the thread acquires a write lock. If the locking + // mechanism doesn't support read locks then this just calls + // <acquire>. + + virtual int tryacquire_read (void); + // Conditionally acquire a read lock. If the locking mechanism + // doesn't support read locks then this just calls <acquire>. + + virtual int tryacquire_write (void); + // Conditionally acquire a write lock. If the locking mechanism + // doesn't support read locks then this just calls <acquire>. + +private: + LOCKING_MECHANISM lock_; + // The concrete locking mechanism that all the methods delegate to. +}; + template <class LOCK, class TYPE> class ACE_Test_and_Set : public ACE_Event_Handler { |