diff options
author | cleeland <cleeland@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-22 02:44:57 +0000 |
---|---|---|
committer | cleeland <cleeland@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-22 02:44:57 +0000 |
commit | f675805aee9e9b7204af17c92365a7ed439f3f72 (patch) | |
tree | d6880b7fa98f0f5acdc46760cf7f910dedb3115b /TAO/IIOP/lib/params.cpp | |
parent | b8d6f0c9f924f501e1e7115981e87dc673027bbb (diff) | |
download | ATCD-f675805aee9e9b7204af17c92365a7ed439f3f72.tar.gz |
Created ROA_Factory as the abstract strategy factory, put
ACE_Strategy_Acceptor in place instead of ACE_Acceptor.
Diffstat (limited to 'TAO/IIOP/lib/params.cpp')
-rw-r--r-- | TAO/IIOP/lib/params.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/TAO/IIOP/lib/params.cpp b/TAO/IIOP/lib/params.cpp index 8e0ca93a366..85540e1a8f4 100644 --- a/TAO/IIOP/lib/params.cpp +++ b/TAO/IIOP/lib/params.cpp @@ -1,6 +1,8 @@ #include "params.hh" +#include "connect.hh" ROA_Parameters* ROA_Parameters::_instance = 0; +ROA_Factory* ROA_Factory::_instance = 0; ROA_Parameters::ROA_Parameters() : using_threads_(0), @@ -22,6 +24,57 @@ ROA_Parameters::instance() return _instance; } +ROA_Factory* +ROA_Factory::instance() +{ + if (_instance == 0) + { + _instance = new ROA_Factory; + } + return _instance; +} + +// Determine the appropriate default thread flags, based on system. +// When I put the concurrency strategy into the factory, then this will +// go away b/c the concurrency strategy will do this appropriate +// for each platform! +# if defined(linux) +# define ROA_DEFAULT_THREADFLAGS (THR_DETACHED) +# elif defined(WIN32) +# define ROA_DEFAULT_THREADFLAGS (THR_DETACHED|THR_SCOPE_PROCESS) +# elif defined(sparc) +# define ROA_DEFAULT_THREADFLAGS (THR_DETACHED|THR_SCOPE_PROCESS) +# else +# define ROA_DEFAULT_THREADFLAGS (THR_DETACHED) +# endif + +ROA_Factory::CONCURRENCY_STRATEGY* +ROA_Factory::concurrency_strategy() +{ + ROA_Parameters* p = ROA_Parameters::instance(); + + + if (p->using_threads()) + { + // Set the strategy parameters + threaded_strategy_.open(ACE_Service_Config::thr_mgr(), ROA_DEFAULT_THREADFLAGS); + concurrency_strategy_ = &threaded_strategy_; + } + else + { + concurrency_strategy_ = 0; + } +} + + #if !defined(__ACE_INLINE__) # include "params.i" #endif + +#if defined(ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +template class ACE_Thread_Strategy<ROA_Handler>; +template class ACE_Concurrency_Strategy<ROA_Handler>; +template class ACE_Creation_Strategy<ROA_Handler>; +template class ACE_Scheduling_Strategy<ROA_Handler>; +template class ACE_Accept_Strategy<ROA_Handler, ACE_SOCK_ACCEPTOR>; +#endif |