#include <EC_MT_Dispatching.h>
Inheritance diagram for TAO_EC_MT_Dispatching:
Public Member Functions | |
TAO_EC_MT_Dispatching (int nthreads, int thread_creation_flags, int thread_priority, int force_activate, TAO_EC_Queue_Full_Service_Object *queue_full_service_object_name) | |
virtual void | activate (void) |
virtual void | shutdown (void) |
virtual void | push (TAO_EC_ProxyPushSupplier *proxy, RtecEventComm::PushConsumer_ptr consumer, const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info ACE_ENV_ARG_DECL) |
virtual void | push_nocopy (TAO_EC_ProxyPushSupplier *proxy, RtecEventComm::PushConsumer_ptr consumer, RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info ACE_ENV_ARG_DECL) |
Private Attributes | |
ACE_Thread_Manager | thread_manager_ |
Use our own thread manager. | |
int | nthreads_ |
The number of active tasks. | |
int | thread_creation_flags_ |
int | thread_priority_ |
The priority of the dispatching threads. | |
int | force_activate_ |
TAO_EC_Dispatching_Task | task_ |
The dispatching task. | |
TAO_SYNCH_MUTEX | lock_ |
Synchronize access to internal data. | |
int | active_ |
Are the threads running? | |
TAO_EC_Queue_Full_Service_Object * | queue_full_service_object_ |
Service Object information. |
This strategy uses a single queue, serviced by one or more threads. It's main purpose is to decouple the suppliers from the client execution time, specially in the collocated case.
Definition at line 39 of file EC_MT_Dispatching.h.
|
Constructor It will create nthreads servicing threads... Definition at line 10 of file EC_MT_Dispatching.cpp. References ACE_Task_Base::open().
00015 : nthreads_ (nthreads), 00016 thread_creation_flags_ (thread_creation_flags), 00017 thread_priority_ (thread_priority), 00018 force_activate_ (force_activate), 00019 active_ (0), 00020 queue_full_service_object_ (service_object) 00021 { 00022 this->task_.open (&this->thread_manager_); 00023 } |
|
Initialize all the data structures, activate any internal threads, etc. Implements TAO_EC_Dispatching. Definition at line 26 of file EC_MT_Dispatching.cpp. References ACE_DEBUG, ACE_ERROR, ACE_GUARD, ACE_Task_Base::activate(), force_activate_, LM_DEBUG, LM_ERROR, and TAO_SYNCH_MUTEX.
00027 { 00028 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); 00029 00030 if (this->active_ != 0) 00031 return; 00032 00033 this->active_ = 1; 00034 00035 if (this->task_.activate (this->thread_creation_flags_, 00036 this->nthreads_, 00037 1, 00038 this->thread_priority_) == -1) 00039 { 00040 if (this->force_activate_ != 0) 00041 { 00042 ACE_DEBUG ((LM_DEBUG, 00043 "EC (%P|%t) activating dispatching queue at" 00044 " default priority\n")); 00045 if (this->task_.activate (THR_BOUND, this->nthreads_) == -1) 00046 ACE_ERROR ((LM_ERROR, 00047 "EC (%P|%t) cannot activate dispatching queue.\n")); 00048 } 00049 } 00050 } |
|
The consumer represented by proxy should receive event. It can use the information in qos_info to determine the event priority (among other things). Implements TAO_EC_Dispatching. Definition at line 68 of file EC_MT_Dispatching.cpp. References ACE_ENV_ARG_PARAMETER, RtecEventComm::EventSet, and push_nocopy().
00073 { 00074 RtecEventComm::EventSet event_copy = event; 00075 this->push_nocopy (proxy, consumer, event_copy, qos_info ACE_ENV_ARG_PARAMETER); 00076 } |
|
Implements TAO_EC_Dispatching. Referenced by push(). |
|
Deactivate any internal threads and cleanup internal data structures, it should only return once the threads have finished their jobs. Implements TAO_EC_Dispatching. Definition at line 53 of file EC_MT_Dispatching.cpp. References ACE_GUARD, nthreads_, ACE_Task< ACE_SYNCH >::putq(), TAO_SYNCH_MUTEX, thread_manager_, and ACE_Thread_Manager::wait().
00054 { 00055 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); 00056 00057 if (this->active_ == 0) 00058 return; 00059 00060 for (int i = 0; i < this->nthreads_; ++i) 00061 { 00062 this->task_.putq (new TAO_EC_Shutdown_Task_Command); 00063 } 00064 this->thread_manager_.wait (); 00065 } |
|
Are the threads running?
Definition at line 89 of file EC_MT_Dispatching.h. |
|
If activation at the requested priority fails then we fallback on the defaults for thread activation. Definition at line 80 of file EC_MT_Dispatching.h. Referenced by activate(). |
|
Synchronize access to internal data.
Definition at line 86 of file EC_MT_Dispatching.h. |
|
The number of active tasks.
Definition at line 69 of file EC_MT_Dispatching.h. Referenced by shutdown(). |
|
Service Object information.
Definition at line 92 of file EC_MT_Dispatching.h. |
|
The dispatching task.
Definition at line 83 of file EC_MT_Dispatching.h. |
|
The flags (THR_BOUND, THR_NEW_LWP, etc.) used to create the dispatching threads. Definition at line 73 of file EC_MT_Dispatching.h. |
|
Use our own thread manager.
Definition at line 66 of file EC_MT_Dispatching.h. Referenced by shutdown(). |
|
The priority of the dispatching threads.
Definition at line 76 of file EC_MT_Dispatching.h. |