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 #include "ace/Task.h" 00013 #include "ace/Synch.h" 00014 #include "ace/Condition_T.h" 00015 00016 namespace OpenDDS { 00017 namespace DCPS { 00018 00019 class PerConnectionSynch : public ACE_Task_Base, 00020 public ThreadSynch { 00021 public: 00022 00023 PerConnectionSynch(ThreadSynchResource* synch_resource, long priority, int scheduler); 00024 virtual ~PerConnectionSynch(); 00025 00026 virtual void work_available(); 00027 00028 virtual int open(void*); 00029 virtual int svc(); 00030 virtual int close(u_long); 00031 00032 OPENDDS_POOL_ALLOCATION_FWD 00033 00034 protected: 00035 00036 virtual int register_worker_i(); 00037 virtual void unregister_worker_i(); 00038 00039 private: 00040 00041 typedef ACE_SYNCH_MUTEX LockType; 00042 typedef ACE_Guard<LockType> GuardType; 00043 typedef ACE_Condition<LockType> ConditionType; 00044 00045 LockType lock_; 00046 ConditionType condition_; 00047 int work_available_; 00048 int shutdown_; 00049 long dds_priority_; 00050 long scheduler_; 00051 }; 00052 00053 } // namespace DCPS 00054 } // namespace OpenDDS 00055 00056 #if defined (__ACE_INLINE__) 00057 #include "PerConnectionSynch.inl" 00058 #endif /* __ACE_INLINE__ */ 00059 00060 #endif /* OPENDDS_DCPS_THREADSYNCH_H */