00001 /* -*- C++ -*- */ 00002 /** 00003 * @file ESF_Busy_Lock.h 00004 * 00005 * ESF_Busy_Lock.h,v 1.9 2006/03/15 07:52:21 jtc Exp 00006 * 00007 * @author Carlos O'Ryan (coryan@cs.wustl.edu) 00008 * 00009 * http://doc.ece.uci.edu/~coryan/EC/index.html 00010 */ 00011 00012 #ifndef TAO_ESF_BUSY_LOCK_H 00013 #define TAO_ESF_BUSY_LOCK_H 00014 00015 #include "ace/config-all.h" 00016 00017 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00018 # pragma once 00019 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00020 00021 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00022 00023 /// Adapt classes that implement the "busy lock" protocol, to conform 00024 /// to the ACE Lock interface. 00025 /** 00026 * The ACE Lock interface allows us to use any mutex-like object with 00027 * the ACE synchronization components (such as guards, Lock_Adapter, 00028 * etc.). 00029 * One of the synchronization protocols used in the event services 00030 * uses the following protocol: 00031 * <UL> 00032 * <LI> To acquire the lock the @c busy method of the object is invoked. 00033 * <LI> To release the lock the @c idle method of the object is invoked. 00034 * <LI> Any changes performed while the lock is held are delayed until 00035 * all the locks are released, i.e. the last call to @c idle 00036 * executes the changes. 00037 * </UL> 00038 */ 00039 template<class Adaptee> 00040 class TAO_ESF_Busy_Lock_Adapter 00041 { 00042 public: 00043 /// Constructor 00044 TAO_ESF_Busy_Lock_Adapter (Adaptee* adaptee); 00045 00046 /** 00047 * @name The ACE_Lock methods 00048 * 00049 * Check the documentation in ace/Synch.h for details. 00050 */ 00051 //@{ 00052 int remove (void); 00053 int acquire (void); 00054 int tryacquire (void); 00055 int release (void); 00056 int acquire_read (void); 00057 int acquire_write (void); 00058 int tryacquire_read (void); 00059 int tryacquire_write (void); 00060 //@} 00061 00062 private: 00063 Adaptee* adaptee_; 00064 }; 00065 00066 TAO_END_VERSIONED_NAMESPACE_DECL 00067 00068 #if defined (__ACE_INLINE__) 00069 #include "orbsvcs/ESF/ESF_Busy_Lock.i" 00070 #endif /* __ACE_INLINE__ */ 00071 00072 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00073 #include "orbsvcs/ESF/ESF_Busy_Lock.cpp" 00074 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00075 00076 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00077 #pragma implementation ("ESF_Busy_Lock.cpp") 00078 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00079 00080 #endif /* TAO_ESF_BUSY_LOCK_H */