|
OpenDDS
Snapshot(2023/04/28-20:55)
|
Execute the requests of sending a sample or control message. More...
#include <ThreadPerConnectionSendTask.h>


Public Member Functions | |
| ThreadPerConnectionSendTask (DataLink *link) | |
| virtual | ~ThreadPerConnectionSendTask () |
| int | add_request (SendStrategyOpType op, TransportQueueElement *element=0) |
| virtual int | open (void *=0) |
| Activate the worker threads. More... | |
| virtual int | svc () |
| The "mainline" executed by the worker thread. More... | |
| virtual int | close (u_long flag=0) |
| Called when the thread exits. More... | |
| RemoveResult | remove_sample (const DataSampleElement *element) |
| Remove sample from the thread per connection queue. More... | |
Public Member Functions inherited from ACE_Task_Base | |
| ACE_Task_Base (ACE_Thread_Manager *=0) | |
| virtual | ~ACE_Task_Base (void) |
| virtual int | module_closed (void) |
| virtual int | put (ACE_Message_Block *, ACE_Time_Value *=0) |
| virtual int | activate (long flags=THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED, int n_threads=1, int force_active=0, long priority=ACE_DEFAULT_THREAD_PRIORITY, int grp_id=-1, ACE_Task_Base *task=0, ACE_hthread_t thread_handles[]=0, void *stack[]=0, size_t stack_size[]=0, ACE_thread_t thread_ids[]=0, const char *thr_name[]=0) |
| virtual int | wait (void) |
| virtual int | suspend (void) |
| virtual int | resume (void) |
| int | grp_id (void) const |
| void | grp_id (int) |
| ACE_Thread_Manager * | thr_mgr (void) const |
| void | thr_mgr (ACE_Thread_Manager *) |
| int | is_reader (void) const |
| int | is_writer (void) const |
| size_t | thr_count (void) const |
| ACE_thread_t | last_thread (void) const |
Public Member Functions inherited from ACE_Service_Object | |
| ACE_Service_Object (ACE_Reactor *=0) | |
| virtual | ~ACE_Service_Object (void) |
Public Member Functions inherited from ACE_Event_Handler | |
| virtual | ~ACE_Event_Handler (void) |
| virtual ACE_HANDLE | get_handle (void) const |
| virtual void | set_handle (ACE_HANDLE) |
| virtual int | priority (void) const |
| virtual void | priority (int priority) |
| virtual int | handle_input (ACE_HANDLE fd=ACE_INVALID_HANDLE) |
| virtual int | handle_output (ACE_HANDLE fd=ACE_INVALID_HANDLE) |
| virtual int | handle_exception (ACE_HANDLE fd=ACE_INVALID_HANDLE) |
| virtual int | handle_timeout (const ACE_Time_Value ¤t_time, const void *act=0) |
| virtual int | handle_exit (ACE_Process *) |
| virtual int | handle_close (ACE_HANDLE handle, ACE_Reactor_Mask close_mask) |
| virtual int | handle_signal (int signum, siginfo_t *=0, ucontext_t *=0) |
| virtual int | resume_handler (void) |
| virtual int | handle_qos (ACE_HANDLE=ACE_INVALID_HANDLE) |
| virtual int | handle_group_qos (ACE_HANDLE=ACE_INVALID_HANDLE) |
| virtual void | reactor (ACE_Reactor *reactor) |
| virtual ACE_Reactor * | reactor (void) const |
| virtual ACE_Reactor_Timer_Interface * | reactor_timer_interface (void) const |
| virtual Reference_Count | add_reference (void) |
| virtual Reference_Count | remove_reference (void) |
| Reference_Counting_Policy & | reference_counting_policy (void) |
Public Member Functions inherited from ACE_Shared_Object | |
| ACE_Shared_Object (void) | |
| virtual | ~ACE_Shared_Object (void) |
| virtual int | init (int argc, ACE_TCHAR *argv[]) |
| virtual int | fini (void) |
| virtual int | info (ACE_TCHAR **info_string, size_t length=0) const |
Private Types | |
| typedef ACE_SYNCH_MUTEX | LockType |
| typedef ACE_Guard< LockType > | GuardType |
| typedef ConditionVariable< LockType > | ConditionVariableType |
| typedef BasicQueue< SendRequest > | QueueType |
Private Member Functions | |
| virtual void | execute (SendRequest &req) |
| Handle the request. More... | |
Private Attributes | |
| LockType | lock_ |
| Lock to protect the "state" (all of the data members) of this object. More... | |
| QueueType | queue_ |
| The request queue. More... | |
| ConditionVariableType | work_available_ |
| bool | shutdown_initiated_ |
| Flag used to initiate a shutdown request to all worker threads. More... | |
| bool | opened_ |
| Flag used to avoid multiple open() calls. More... | |
| ACE_thread_t | thr_id_ |
| The id of the thread created by this task. More... | |
| DataLink * | link_ |
| The datalink to send the samples or control messages. More... | |
Execute the requests of sending a sample or control message.
This task implements the request execute method which handles each step of sending a sample or control message.
Definition at line 57 of file ThreadPerConnectionSendTask.h.
|
private |
Definition at line 87 of file ThreadPerConnectionSendTask.h.
|
private |
Definition at line 86 of file ThreadPerConnectionSendTask.h.
|
private |
Definition at line 85 of file ThreadPerConnectionSendTask.h.
|
private |
Definition at line 89 of file ThreadPerConnectionSendTask.h.
| OpenDDS::DCPS::ThreadPerConnectionSendTask::ThreadPerConnectionSendTask | ( | DataLink * | link | ) |
Definition at line 26 of file ThreadPerConnectionSendTask.cpp.
References DBG_ENTRY_LVL, and NULL_thread.
|
virtual |
| int OpenDDS::DCPS::ThreadPerConnectionSendTask::add_request | ( | SendStrategyOpType | op, |
| TransportQueueElement * | element = 0 |
||
| ) |
Put the request to the request queue. Returns 0 if successful, -1 otherwise (it has been "rejected" or this task is shutdown).
Definition at line 42 of file ThreadPerConnectionSendTask.cpp.
References ACE_ERROR, ACE_TEXT(), DBG_ENTRY, ACE_Auto_Basic_Ptr< X >::get(), LM_ERROR, lock_, OpenDDS::DCPS::ConditionVariable< Mutex >::notify_one(), OpenDDS::DCPS::BasicQueue< T >::put(), queue_, ACE_Auto_Basic_Ptr< X >::release(), OpenDDS::DCPS::SEND_STOP, shutdown_initiated_, and work_available_.
|
virtual |
Called when the thread exits.
Reimplemented from ACE_Task_Base.
Definition at line 191 of file ThreadPerConnectionSendTask.cpp.
References DBG_ENTRY, lock_, OpenDDS::DCPS::ConditionVariable< Mutex >::notify_all(), opened_, shutdown_initiated_, TheServiceParticipant, ACE_OS::thr_equal(), thr_id_, ACE_OS::thr_self(), ACE_Task_Base::wait(), and work_available_.
|
privatevirtual |
Handle the request.
Definition at line 234 of file ThreadPerConnectionSendTask.cpp.
References ACE_ERROR, DBG_ENTRY_LVL, OpenDDS::DCPS::SendRequest::element_, OpenDDS::DCPS::GUID_UNKNOWN, link_, LM_ERROR, OpenDDS::DCPS::SendRequest::op_, OPENDDS_END_VERSIONED_NAMESPACE_DECL, OpenDDS::DCPS::SEND, OpenDDS::DCPS::DataLink::send_i(), OpenDDS::DCPS::SEND_START, OpenDDS::DCPS::DataLink::send_start_i(), OpenDDS::DCPS::SEND_STOP, and OpenDDS::DCPS::DataLink::send_stop_i().
Referenced by svc().
|
virtual |
Activate the worker threads.
Reimplemented from ACE_Task_Base.
Definition at line 77 of file ThreadPerConnectionSendTask.cpp.
References ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT(), ACE_Task_Base::activate(), DBG_ENTRY, OpenDDS::DCPS::DCPS_debug_level, link_, LM_DEBUG, LM_ERROR, lock_, opened_, ACE_Event_Handler::priority(), TheServiceParticipant, and OpenDDS::DCPS::DataLink::transport_priority().
| RemoveResult OpenDDS::DCPS::ThreadPerConnectionSendTask::remove_sample | ( | const DataSampleElement * | element | ) |
Remove sample from the thread per connection queue.
Definition at line 220 of file ThreadPerConnectionSendTask.cpp.
References OpenDDS::DCPS::BasicQueue< T >::accept_visitor(), ACE_Message_Block::cont(), DBG_ENTRY, OpenDDS::DCPS::DataSampleElement::get_sample(), lock_, queue_, and OpenDDS::DCPS::ThreadPerConRemoveVisitor::status().
|
virtual |
The "mainline" executed by the worker thread.
Reimplemented from ACE_Task_Base.
Definition at line 129 of file ThreadPerConnectionSendTask.cpp.
References DBG_ENTRY_LVL, execute(), OpenDDS::DCPS::BasicQueue< T >::get(), lock_, OpenDDS::DCPS::OPENDDS_VECTOR(), queue_, OpenDDS::DCPS::SEND_STOP, shutdown_initiated_, SIG_SETMASK, ACE_OS::sigfillset(), OpenDDS::DCPS::BasicQueue< T >::size(), TheServiceParticipant, thr_id_, ACE_OS::thr_self(), ACE_OS::thr_sigsetmask(), OpenDDS::DCPS::ConditionVariable< Mutex >::wait(), and work_available_.
|
private |
The datalink to send the samples or control messages.
Definition at line 113 of file ThreadPerConnectionSendTask.h.
|
private |
Lock to protect the "state" (all of the data members) of this object.
Definition at line 92 of file ThreadPerConnectionSendTask.h.
Referenced by add_request(), close(), open(), remove_sample(), and svc().
|
private |
Flag used to avoid multiple open() calls.
Definition at line 107 of file ThreadPerConnectionSendTask.h.
|
private |
The request queue.
Definition at line 95 of file ThreadPerConnectionSendTask.h.
Referenced by add_request(), remove_sample(), and svc().
|
private |
Flag used to initiate a shutdown request to all worker threads.
Definition at line 104 of file ThreadPerConnectionSendTask.h.
Referenced by add_request(), close(), and svc().
|
private |
The id of the thread created by this task.
Definition at line 110 of file ThreadPerConnectionSendTask.h.
|
private |
Condition used to signal the worker threads that they may be able to find a request in the queue_ that needs to be executed. This condition will be signal()'ed each time a request is added to the queue_, and also when this task is shutdown.
Definition at line 101 of file ThreadPerConnectionSendTask.h.
Referenced by add_request(), close(), and svc().
1.8.13