#include <Strategies_T.h>
Inheritance diagram for ACE_Thread_Strategy:


Public Types | |
| typedef ACE_Concurrency_Strategy< SVC_HANDLER > | base_type |
Public Methods | |
| ACE_Thread_Strategy (int flags=0) | |
| "Do-nothing constructor". More... | |
| ACE_Thread_Strategy (ACE_Thread_Manager *tm, long thr_flags, int n_threads=1, int flags=0) | |
| Initialize the strategy. More... | |
| virtual int | open (ACE_Thread_Manager *tm, long thr_flags, int n_threads=1, int flags=0) |
| Initialize the strategy. More... | |
| 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. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Protected Types | |
| typedef ACE_Concurrency_Strategy< SVC_HANDLER > | inherited |
Protected Attributes | |
| ACE_Thread_Manager * | thr_mgr_ |
| Thread manager for this class (must be provided). More... | |
| long | thr_flags_ |
| Flags to pass into the <SVC_HANDLER::activate> method. More... | |
| int | n_threads_ |
| Number of threads to spawn. More... | |
This class provides a strategy that manages the creation of threads to handle requests from clients concurrently. It behaves as a "thread factory", spawning threads "on-demand" to run the service specified by a user-supplied <SVC_HANDLER>.
Definition at line 355 of file Strategies_T.h.
|
|||||
|
Definition at line 360 of file Strategies_T.h. |
|
|||||
|
Definition at line 397 of file Strategies_T.h. |
|
||||||||||
|
"Do-nothing constructor".
Definition at line 182 of file Strategies_T.i. References ACE_TRACE.
00183 : ACE_Concurrency_Strategy<SVC_HANDLER> (flags), 00184 thr_mgr_ (0), 00185 thr_flags_ (0), 00186 n_threads_ (1) 00187 { 00188 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy"); 00189 } |
|
||||||||||||||||||||||||
|
Initialize the strategy.
Definition at line 165 of file Strategies_T.i. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, LM_ERROR, and open.
00169 {
00170 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy");
00171
00172 if (this->open (thr_mgr,
00173 thr_flags,
00174 n_threads,
00175 flags) == -1)
00176 ACE_ERROR ((LM_ERROR,
00177 ACE_LIB_TEXT ("%p\n"),
00178 ACE_LIB_TEXT ("ACE_Thread_Strategy<SVC_HANDLER>::ACE_Thread_Strategy")));
00179 }
|
|
||||||||||
|
Definition at line 192 of file Strategies_T.i. References ACE_TRACE.
00193 {
00194 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::~ACE_Thread_Strategy");
00195 }
|
|
||||||||||||||||
|
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. Definition at line 232 of file Strategies_T.cpp. References ACE_TRACE.
00234 {
00235 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::activate_svc_handler");
00236 // Call up to our parent to do the SVC_HANDLER initialization.
00237 if (this->inherited::activate_svc_handler (svc_handler,
00238 arg) == -1)
00239 return -1;
00240 else
00241 // Turn the <svc_handler> into an active object (if it isn't
00242 // already one as a result of the first activation...)
00243 return svc_handler->activate (this->thr_flags_,
00244 this->n_threads_);
00245 }
|
|
||||||||||
|
Dump the state of an object.
Reimplemented from ACE_Concurrency_Strategy. Definition at line 1161 of file Strategies_T.cpp. References ACE_TRACE.
01162 {
01163 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::dump");
01164 }
|
|
||||||||||||||||||||||||
|
Initialize the strategy.
Definition at line 211 of file Strategies_T.cpp. References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_TRACE, ACE_Concurrency_Strategy::flags_, LM_ERROR, n_threads_, thr_flags_, and thr_mgr_. Referenced by ACE_Thread_Strategy.
00215 {
00216 ACE_TRACE ("ACE_Thread_Strategy<SVC_HANDLER>::open");
00217 this->thr_mgr_ = thr_mgr;
00218 this->n_threads_ = n_threads;
00219 this->thr_flags_ = thr_flags;
00220 this->flags_ = flags;
00221
00222 // Must have a thread manager!
00223 if (this->thr_mgr_ == 0)
00224 ACE_ERROR_RETURN ((LM_ERROR,
00225 ACE_LIB_TEXT ("error: must have a non-NULL thread manager\n")),
00226 -1);
00227 else
00228 return 0;
00229 }
|
|
|||||
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_Concurrency_Strategy. Definition at line 394 of file Strategies_T.h. |
|
|||||
|
Number of threads to spawn.
Definition at line 406 of file Strategies_T.h. Referenced by open. |
|
|||||
|
Flags to pass into the <SVC_HANDLER::activate> method.
Definition at line 403 of file Strategies_T.h. Referenced by open. |
|
|||||
|
Thread manager for this class (must be provided).
Definition at line 400 of file Strategies_T.h. Referenced by open. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002