TAO_Dynamic_Thread_Pool_Threads Class Reference

Class representing a dynamic thread running in a thread lane. More...

#include <Thread_Pool.h>

Inheritance diagram for TAO_Dynamic_Thread_Pool_Threads:

Inheritance graph
[legend]
Collaboration diagram for TAO_Dynamic_Thread_Pool_Threads:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_Dynamic_Thread_Pool_Threads (TAO_Thread_Lane &lane)
 Constructor.

Protected Member Functions

virtual int run (TAO_ORB_Core &orb_core)
 Do the real work.

Detailed Description

Class representing a dynamic thread running in a thread lane.

Definition at line 105 of file Thread_Pool.h.


Constructor & Destructor Documentation

TAO_Dynamic_Thread_Pool_Threads::TAO_Dynamic_Thread_Pool_Threads ( TAO_Thread_Lane lane  ) 

Constructor.

Definition at line 98 of file Thread_Pool.cpp.

00099   : TAO_Thread_Pool_Threads (lane)
00100 {
00101 }


Member Function Documentation

int TAO_Dynamic_Thread_Pool_Threads::run ( TAO_ORB_Core orb_core  )  [protected, virtual]

Do the real work.

Reimplemented from TAO_Thread_Pool_Threads.

Definition at line 104 of file Thread_Pool.cpp.

References ACE_DEBUG, ACE_TEXT, TAO_Thread_Lane::dynamic_thread_time(), TAO_ORB_Core::has_shutdown(), TAO_Thread_Lane::id(), TAO_Thread_Pool_Threads::lane_, LM_DEBUG, TAO_ORB_Core::orb(), CORBA::ORB::run(), TAO_debug_level, TAO_RT_ORBInitializer::TAO_RTCORBA_DT_FIXED, TAO_RT_ORBInitializer::TAO_RTCORBA_DT_IDLE, TAO_RT_ORBInitializer::TAO_RTCORBA_DT_INFINITIVE, ACE_Task_Base::thr_count(), and CORBA::ORB::work_pending().

00105 {
00106   CORBA::ORB_ptr orb = orb_core.orb ();
00107 
00108   switch (this->lane_.lifespan ())
00109   {
00110     case TAO_RT_ORBInitializer::TAO_RTCORBA_DT_FIXED :
00111       {
00112         ACE_Time_Value tv_run (this->lane_.dynamic_thread_time ());
00113         orb->run (tv_run);
00114       }
00115       break;
00116     case TAO_RT_ORBInitializer::TAO_RTCORBA_DT_IDLE :
00117       {
00118         // A timeout is specified, run the ORB in an idle loop, if we
00119         // don't handle any operations for the given timeout we just
00120         // exit the loop and this thread ends itself.
00121         ACE_Time_Value tv (this->lane_.dynamic_thread_time ());
00122         while (!orb_core.has_shutdown () && orb->work_pending (tv))
00123           {
00124             // Run the ORB for the specified timeout, this prevents looping
00125             // between work_pending/handle_events
00126             tv = this->lane_.dynamic_thread_time ();
00127             orb->run (tv);
00128             // Reset the idle timeout
00129             tv = this->lane_.dynamic_thread_time ();
00130           }
00131       }
00132       break;
00133     case TAO_RT_ORBInitializer::TAO_RTCORBA_DT_INFINITIVE :
00134       {
00135         // No timeout specified, run the ORB until it shutdowns
00136         orb->run ();
00137       }
00138       break;
00139   }
00140 
00141   if (TAO_debug_level > 7)
00142     {
00143       ACE_DEBUG ((LM_DEBUG,
00144                   ACE_TEXT ("TAO Process %P Pool %d Lane %d Thread %t\n")
00145                   ACE_TEXT ("Current number of dynamic threads left = %d; ")
00146                   ACE_TEXT ("RTCorba worker thread is ending!\n"),
00147                   this->lane_.pool ().id (),
00148                   this->lane_.id (),
00149                   this->thr_count () - 1));
00150     }
00151 
00152   return 0;
00153 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:42:56 2010 for TAO_RTCORBA by  doxygen 1.4.7