Public Member Functions | Protected Member Functions

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 101 of file Thread_Pool.cpp.


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 107 of file Thread_Pool.cpp.

{
  CORBA::ORB_ptr orb = orb_core.orb ();

  switch (this->lane_.lifespan ())
  {
    case TAO_RT_ORBInitializer::TAO_RTCORBA_DT_FIXED :
      {
        ACE_Time_Value tv_run (this->lane_.dynamic_thread_time ());
        orb->run (tv_run);
      }
      break;
    case TAO_RT_ORBInitializer::TAO_RTCORBA_DT_IDLE :
      {
        // A timeout is specified, run the ORB in an idle loop, if we
        // don't handle any operations for the given timeout we just
        // exit the loop and this thread ends itself.
        ACE_Time_Value tv (this->lane_.dynamic_thread_time ());
        while (!orb_core.has_shutdown () && orb->work_pending (tv))
          {
            // Run the ORB for the specified timeout, this prevents looping
            // between work_pending/handle_events
            tv = this->lane_.dynamic_thread_time ();
            orb->run (tv);
            // Reset the idle timeout
            tv = this->lane_.dynamic_thread_time ();
          }
      }
      break;
    case TAO_RT_ORBInitializer::TAO_RTCORBA_DT_INFINITIVE :
      {
        // No timeout specified, run the ORB until it shutdowns
        orb->run ();
      }
      break;
  }

  if (TAO_debug_level > 7)
    {
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("TAO Process %P Pool %d Lane %d Thread %t\n")
                  ACE_TEXT ("Current number of dynamic threads left = %d; ")
                  ACE_TEXT ("RTCorba worker thread is ending!\n"),
                  this->lane_.pool ().id (),
                  this->lane_.id (),
                  this->thr_count () - 1));
    }

  return 0;
}


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines