OpenDDS
Snapshot(2023/04/07-19:43)
|
#include <ThreadSynch.h>
Public Member Functions | |
virtual | ~ThreadSynch () |
int | register_worker (ThreadSynchWorker &worker) |
void | unregister_worker () |
Our owner, the worker_, is breaking our relationship. More... | |
virtual void | work_available ()=0 |
Protected Member Functions | |
ThreadSynch (ThreadSynchResource *resource) | |
int | wait_on_clogged_resource () |
virtual int | register_worker_i () |
virtual void | unregister_worker_i () |
WeakRcHandle< ThreadSynchWorker > | worker () |
Access the worker implementation directly. More... | |
Private Attributes | |
WeakRcHandle< ThreadSynchWorker > | worker_ |
unique_ptr< ThreadSynchResource > | resource_ |
This class is the base class for different ThreadSynch stratege, currently only the thread per connection strategy is implemented and used.
Notes for object ownership: 1) Pointer to TransportSendStrategy object (as ThreadSynchWorker) directly but not reference counted. It won't have access problem during it lifetime because the TransportSendStrategy object owns this ThreadSynch object. 2) The ThreadSynch object is created by the ThreadSynchResource object and it owns the ThreadSynchResource object.
Definition at line 34 of file ThreadSynch.h.
|
virtual |
|
protected |
Note that we allow the ThreadSynchResource pointer to be NULL to support the NullSynch case.
Definition at line 14 of file ThreadSynch.inl.
References ACE_INLINE, and DBG_ENTRY_LVL.
ACE_INLINE int OpenDDS::DCPS::ThreadSynch::register_worker | ( | ThreadSynchWorker & | worker | ) |
The worker must introduce himself to this ThreadSynch object. It is the worker object that "owns" this ThreadSynch object. Returns 0 for success, -1 for failure.
Definition at line 28 of file ThreadSynch.inl.
References ACE_INLINE, DBG_ENTRY_LVL, OpenDDS::DCPS::ThreadSynchWorker::get_handle(), register_worker_i(), resource_, worker(), and worker_.
|
protectedvirtual |
The default implementation is to do nothing here. The subclass may override the implementation in order to do something when the worker registers. Returns 0 for success, -1 for failure.
Reimplemented in OpenDDS::DCPS::PerConnectionSynch.
Definition at line 21 of file ThreadSynch.cpp.
References DBG_ENTRY_LVL.
Referenced by register_worker().
ACE_INLINE void OpenDDS::DCPS::ThreadSynch::unregister_worker | ( | ) |
Our owner, the worker_, is breaking our relationship.
Definition at line 38 of file ThreadSynch.inl.
References ACE_INLINE, DBG_ENTRY_LVL, and unregister_worker_i().
|
protectedvirtual |
The default implementation is to do nothing here. The subclass may override the implementation in order to do something when the worker unregisters.
Reimplemented in OpenDDS::DCPS::PerConnectionSynch, and OpenDDS::DCPS::PoolSynch.
Definition at line 29 of file ThreadSynch.cpp.
References DBG_ENTRY_LVL.
Referenced by unregister_worker().
|
protected |
Definition at line 46 of file ThreadSynch.inl.
References ACE_ERROR, DBG_ENTRY_LVL, LM_ERROR, and resource_.
Referenced by OpenDDS::DCPS::PerConnectionSynch::svc().
|
pure virtual |
The ThreadSynchWorker would like to have its perform_work() called from the appropriate thread once the ThreadSynchResource claims that it is_ready_for_work().
Implemented in OpenDDS::DCPS::ReactorSynch, OpenDDS::DCPS::PerConnectionSynch, OpenDDS::DCPS::PoolSynch, and OpenDDS::DCPS::NullSynch.
Referenced by OpenDDS::DCPS::TcpSendStrategy::schedule_output().
|
protected |
Access the worker implementation directly.
Definition at line 22 of file ThreadSynch.inl.
References ACE_INLINE, and worker_.
Referenced by OpenDDS::DCPS::ReactorSynch::ReactorSynch(), register_worker(), OpenDDS::DCPS::PerConnectionSynch::svc(), and OpenDDS::DCPS::ReactorSynch::~ReactorSynch().
|
private |
Definition at line 75 of file ThreadSynch.h.
Referenced by register_worker(), and wait_on_clogged_resource().
|
private |
Definition at line 74 of file ThreadSynch.h.
Referenced by register_worker(), and worker().