Defines the interface for specifying a concurrency strategy for a SVC_HANDLER based on multithreading. More...
#include <Strategies_T.h>
Public Types | |
typedef ACE_Concurrency_Strategy < SVC_HANDLER > | base_type |
Public Member Functions | |
ACE_Thread_Strategy (int flags=0) | |
"Do-nothing constructor" | |
ACE_Thread_Strategy (ACE_Thread_Manager *tm, long thr_flags, int n_threads=1, int flags=0) | |
Initialize the strategy. | |
virtual int | open (ACE_Thread_Manager *tm, long thr_flags, int n_threads=1, int flags=0) |
Initialize the strategy. | |
virtual | ~ACE_Thread_Strategy (void) |
virtual int | activate_svc_handler (SVC_HANDLER *svc_handler, void *arg=0) |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Protected Types | |
typedef ACE_Concurrency_Strategy < SVC_HANDLER > | inherited |
Protected Attributes | |
ACE_Thread_Manager * | thr_mgr_ |
Thread manager for this class (must be provided). | |
long | thr_flags_ |
Flags to pass into the <SVC_HANDLER::activate> method. | |
int | n_threads_ |
Number of threads to spawn. |
Defines the interface for specifying a concurrency strategy for a SVC_HANDLER based on multithreading.
This class provides a strategy that manages the creation of threads to handle requests from clients concurrently via a thread-per-connection model. It behaves as a "thread factory", spawning threads "on-demand" to run the service specified by a user-supplied SVC_HANDLER.
Definition at line 359 of file Strategies_T.h.
typedef ACE_Concurrency_Strategy<SVC_HANDLER> ACE_Thread_Strategy< SVC_HANDLER >::base_type |
Definition at line 364 of file Strategies_T.h.
typedef ACE_Concurrency_Strategy<SVC_HANDLER> ACE_Thread_Strategy< SVC_HANDLER >::inherited [protected] |
Definition at line 401 of file Strategies_T.h.
ACE_Thread_Strategy< SVC_HANDLER >::ACE_Thread_Strategy | ( | int | flags = 0 |
) |
"Do-nothing constructor"
Definition at line 114 of file Strategies_T.inl.
: ACE_Concurrency_Strategy<SVC_HANDLER> (flags), thr_mgr_ (0), thr_flags_ (0), n_threads_ (1) { ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy"); }
ACE_Thread_Strategy< SVC_HANDLER >::ACE_Thread_Strategy | ( | ACE_Thread_Manager * | tm, | |
long | thr_flags, | |||
int | n_threads = 1 , |
|||
int | flags = 0 | |||
) |
Initialize the strategy.
Definition at line 97 of file Strategies_T.inl.
ACE_Thread_Strategy< SVC_HANDLER >::~ACE_Thread_Strategy | ( | void | ) | [virtual] |
Definition at line 1275 of file Strategies_T.cpp.
{ ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::~ACE_Thread_Strategy"); }
int ACE_Thread_Strategy< SVC_HANDLER >::activate_svc_handler | ( | SVC_HANDLER * | svc_handler, | |
void * | arg = 0 | |||
) | [virtual] |
Activate the svc_handler with an appropriate concurrency strategy. This method activates the SVC_HANDLER by first calling its <open> method and then calling its <activate> method to turn it into an active object.
Reimplemented from ACE_Concurrency_Strategy< SVC_HANDLER >.
Definition at line 287 of file Strategies_T.cpp.
{ ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::activate_svc_handler"); // Call up to our parent to do the SVC_HANDLER initialization. if (this->inherited::activate_svc_handler (svc_handler, arg) == -1) return -1; else // Turn the <svc_handler> into an active object (if it isn't // already one as a result of the first activation...) return svc_handler->activate (this->thr_flags_, this->n_threads_); }
void ACE_Thread_Strategy< SVC_HANDLER >::dump | ( | void | ) | const |
Dump the state of an object.
Reimplemented from ACE_Concurrency_Strategy< SVC_HANDLER >.
Definition at line 1281 of file Strategies_T.cpp.
{ #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::dump"); #endif /* ACE_HAS_DUMP */ }
int ACE_Thread_Strategy< SVC_HANDLER >::open | ( | ACE_Thread_Manager * | tm, | |
long | thr_flags, | |||
int | n_threads = 1 , |
|||
int | flags = 0 | |||
) | [virtual] |
Initialize the strategy.
Definition at line 266 of file Strategies_T.cpp.
{ ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::open"); this->thr_mgr_ = thr_mgr; this->n_threads_ = n_threads; this->thr_flags_ = thr_flags; this->flags_ = flags; // Must have a thread manager! if (this->thr_mgr_ == 0) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("error: must have a non-NULL thread manager\n")), -1); else return 0; }
ACE_Thread_Strategy< SVC_HANDLER >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
Reimplemented from ACE_Concurrency_Strategy< SVC_HANDLER >.
Definition at line 398 of file Strategies_T.h.
int ACE_Thread_Strategy< SVC_HANDLER >::n_threads_ [protected] |
Number of threads to spawn.
Definition at line 410 of file Strategies_T.h.
long ACE_Thread_Strategy< SVC_HANDLER >::thr_flags_ [protected] |
Flags to pass into the <SVC_HANDLER::activate> method.
Definition at line 407 of file Strategies_T.h.
ACE_Thread_Manager* ACE_Thread_Strategy< SVC_HANDLER >::thr_mgr_ [protected] |
Thread manager for this class (must be provided).
Definition at line 404 of file Strategies_T.h.