#include <Strategies_T.h>
Inheritance diagram for ACE_Thread_Strategy< SVC_HANDLER >:
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. |
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_INLINE ACE_Thread_Strategy< SVC_HANDLER >::ACE_Thread_Strategy | ( | int | flags = 0 |
) |
"Do-nothing constructor"
Definition at line 114 of file Strategies_T.inl.
References ACE_TRACE.
00115 : ACE_Concurrency_Strategy<SVC_HANDLER> (flags), 00116 thr_mgr_ (0), 00117 thr_flags_ (0), 00118 n_threads_ (1) 00119 { 00120 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy"); 00121 }
ACE_INLINE 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.
References ACE_ERROR, ACE_TEXT, ACE_TRACE, and LM_ERROR.
00101 { 00102 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy"); 00103 00104 if (this->open (thr_mgr, 00105 thr_flags, 00106 n_threads, 00107 flags) == -1) 00108 ACE_ERROR ((LM_ERROR, 00109 ACE_TEXT ("%p\n"), 00110 ACE_TEXT ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy"))); 00111 }
ACE_Thread_Strategy< SVC_HANDLER >::~ACE_Thread_Strategy | ( | void | ) | [virtual] |
Definition at line 1271 of file Strategies_T.cpp.
References ACE_TRACE.
01272 { 01273 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::~ACE_Thread_Strategy"); 01274 }
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 282 of file Strategies_T.cpp.
References ACE_TRACE.
00284 { 00285 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::activate_svc_handler"); 00286 // Call up to our parent to do the SVC_HANDLER initialization. 00287 if (this->inherited::activate_svc_handler (svc_handler, 00288 arg) == -1) 00289 return -1; 00290 else 00291 // Turn the <svc_handler> into an active object (if it isn't 00292 // already one as a result of the first activation...) 00293 return svc_handler->activate (this->thr_flags_, 00294 this->n_threads_); 00295 }
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 1277 of file Strategies_T.cpp.
References ACE_TRACE.
01278 { 01279 #if defined (ACE_HAS_DUMP) 01280 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::dump"); 01281 #endif /* ACE_HAS_DUMP */ 01282 }
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 261 of file Strategies_T.cpp.
References ACE_ERROR_RETURN, ACE_TEXT, ACE_TRACE, ACE_Concurrency_Strategy< SVC_HANDLER >::flags_, LM_ERROR, ACE_Thread_Strategy< SVC_HANDLER >::n_threads_, ACE_Thread_Strategy< SVC_HANDLER >::thr_flags_, and ACE_Thread_Strategy< SVC_HANDLER >::thr_mgr_.
00265 { 00266 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::open"); 00267 this->thr_mgr_ = thr_mgr; 00268 this->n_threads_ = n_threads; 00269 this->thr_flags_ = thr_flags; 00270 this->flags_ = flags; 00271 00272 // Must have a thread manager! 00273 if (this->thr_mgr_ == 0) 00274 ACE_ERROR_RETURN ((LM_ERROR, 00275 ACE_TEXT ("error: must have a non-NULL thread manager\n")), 00276 -1); 00277 else 00278 return 0; 00279 }
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.
Referenced by ACE_Thread_Strategy< SVC_HANDLER >::open().
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.
Referenced by ACE_Thread_Strategy< SVC_HANDLER >::open().
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.
Referenced by ACE_Thread_Strategy< SVC_HANDLER >::open().