00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_POOLSYNCHSTRATEGY_H 00009 #define OPENDDS_DCPS_POOLSYNCHSTRATEGY_H 00010 00011 #include "dds/DCPS/dcps_export.h" 00012 #include "ThreadSynchStrategy.h" 00013 00014 #include "ace/Condition_T.h" 00015 #include "ace/Condition_Thread_Mutex.h" 00016 #include "ace/Synch_Traits.h" 00017 #include "ace/Task.h" 00018 00019 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00020 00021 namespace OpenDDS { 00022 namespace DCPS { 00023 00024 class OpenDDS_Dcps_Export PoolSynchStrategy : public ACE_Task_Base, 00025 public ThreadSynchStrategy { 00026 public: 00027 00028 PoolSynchStrategy(); 00029 virtual ~PoolSynchStrategy(); 00030 00031 virtual ThreadSynch* create_synch_object( 00032 ThreadSynchResource* synch_resource, 00033 long priority, 00034 int scheduler); 00035 00036 virtual int open(void*); 00037 virtual int svc(); 00038 virtual int close(u_long); 00039 00040 void operator delete (void* ptr) { ThreadSynchStrategy::operator delete(ptr); } 00041 private: 00042 00043 typedef ACE_SYNCH_MUTEX LockType; 00044 typedef ACE_Guard<LockType> GuardType; 00045 typedef ACE_Condition<LockType> ConditionType; 00046 00047 LockType lock_; 00048 ConditionType condition_; 00049 }; 00050 00051 } // namespace DCPS 00052 } // namespace OpenDDS 00053 00054 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00055 00056 #if defined (__ACE_INLINE__) 00057 #include "PoolSynchStrategy.inl" 00058 #endif /* __ACE_INLINE__ */ 00059 00060 #endif /* OPENDDS_DCPS_POOLSYNCHSTRATEGY_H */