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