00001 /* -*- C++ -*- */ 00002 /** 00003 * @file ESF_Busy_Lock.h 00004 * 00005 * $Id: ESF_Busy_Lock.h 90386 2010-06-02 13:52:08Z vzykov $ 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 #include /**/ "tao/Versioned_Namespace.h" 00022 00023 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00024 00025 /// Adapt classes that implement the "busy lock" protocol, to conform 00026 /// to the ACE Lock interface. 00027 /** 00028 * The ACE Lock interface allows us to use any mutex-like object with 00029 * the ACE synchronization components (such as guards, Lock_Adapter, 00030 * etc.). 00031 * One of the synchronization protocols used in the event services 00032 * uses the following protocol: 00033 * <UL> 00034 * <LI> To acquire the lock the @c busy method of the object is invoked. 00035 * <LI> To release the lock the @c idle method of the object is invoked. 00036 * <LI> Any changes performed while the lock is held are delayed until 00037 * all the locks are released, i.e. the last call to @c idle 00038 * executes the changes. 00039 * </UL> 00040 */ 00041 template<class Adaptee> 00042 class TAO_ESF_Busy_Lock_Adapter 00043 { 00044 public: 00045 /// Constructor 00046 TAO_ESF_Busy_Lock_Adapter (Adaptee* adaptee); 00047 00048 /** 00049 * @name The ACE_Lock methods 00050 * 00051 * Check the documentation in ace/Synch.h for details. 00052 */ 00053 //@{ 00054 int remove (void); 00055 int acquire (void); 00056 int tryacquire (void); 00057 int release (void); 00058 int acquire_read (void); 00059 int acquire_write (void); 00060 int tryacquire_read (void); 00061 int tryacquire_write (void); 00062 //@} 00063 00064 private: 00065 Adaptee* adaptee_; 00066 }; 00067 00068 TAO_END_VERSIONED_NAMESPACE_DECL 00069 00070 #if defined (__ACE_INLINE__) 00071 #include "orbsvcs/ESF/ESF_Busy_Lock.inl" 00072 #endif /* __ACE_INLINE__ */ 00073 00074 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00075 #include "orbsvcs/ESF/ESF_Busy_Lock.cpp" 00076 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00077 00078 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00079 #pragma implementation ("ESF_Busy_Lock.cpp") 00080 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00081 00082 #endif /* TAO_ESF_BUSY_LOCK_H */