diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-30 20:51:16 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-08-30 20:51:16 +0000 |
commit | 6ed5aac3b48fd166ae0409f942869721920a4dec (patch) | |
tree | 3a2e955790abe4cac5291c72827ebcde8150e805 /TAO/tao/Pool_Per_Endpoint.cpp | |
parent | a7a4b3602d6eb2e6cd06f5197ab645a343ca243b (diff) | |
download | ATCD-6ed5aac3b48fd166ae0409f942869721920a4dec.tar.gz |
ChangeLogTag:Mon Aug 30 15:15:39 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Pool_Per_Endpoint.cpp')
-rw-r--r-- | TAO/tao/Pool_Per_Endpoint.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/TAO/tao/Pool_Per_Endpoint.cpp b/TAO/tao/Pool_Per_Endpoint.cpp new file mode 100644 index 00000000000..80bfc839080 --- /dev/null +++ b/TAO/tao/Pool_Per_Endpoint.cpp @@ -0,0 +1,84 @@ +// $Id$ + +#include "tao/Pool_Per_Endpoint.h" +#include "tao/ORB.h" +#include "tao/ORB_Core.h" +#include "tao/Acceptor_Registry.h" +#include "tao/Pluggable.h" +#include "tao/Priority_Mapping.h" +#include "ace/Sched_Params.h" + +#if !defined (__ACE_INLINE__) +# include "tao/Pool_Per_Endpoint.i" +#endif /* ! __ACE_INLINE__ */ + +ACE_RCSID(tao, Pool_Per_Endpoint, "$Id$") + +TAO_Pool_Per_Endpoint::TAO_Pool_Per_Endpoint (CORBA::ORB_ptr orb, + int policy, + int poolsize) + : orb_ (CORBA::ORB::_duplicate (orb)), + policy_ (policy), + poolsize_ (poolsize) +{ + this->thr_mgr (&this->thread_manager_); +} + +TAO_Pool_Per_Endpoint::~TAO_Pool_Per_Endpoint (void) +{ +} + +void +TAO_Pool_Per_Endpoint::run (CORBA::Environment &ACE_TRY_ENV) +{ + TAO_Acceptor_Registry *ac = + this->orb_->orb_core ()->acceptor_registry (); + + for (TAO_AcceptorSetItor i = ac->begin (); i != ac->end (); ++i) + { + int priority = + ACE_Sched_Params::priority_min (this->policy_); + +#if defined (TAO_HAS_RT_CORBA) + RTCORBA::PriorityMapping *pm = + this->orb_->orb_core ()->priority_mapping (); + const CORBA::Short corba_priority = (*i)->priority (); + CORBA::Short native_priority; + if (pm->to_native (corba_priority, native_priority) == 1) + priority = native_priority; + + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - creating thread at priority %d:%d\n", + priority, corba_priority)); +#endif /* TAO_HAS_RT_CORBA */ + if (this->activate (THR_NEW_LWP | THR_JOINABLE + | THR_BOUND | THR_SCHED_FIFO, + this->poolsize_, /* number of threads */ + 1, /* force active */ + priority) == -1) + { + ACE_THROW (CORBA::INTERNAL ()); + } + } + this->thread_manager_.wait (); +} + +int +TAO_Pool_Per_Endpoint::svc (void) +{ + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - TAO_Pool_Per_Endpoint::svc: " + " using reactor <%x> in this thread\n", + this->orb_->orb_core ()->reactor ())); + this->orb_->run (); + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - TAO_Pool_Per_Endpoint::svc: " + " ORB::run() finished\n")); + return 0; +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ |