TAO_RTCORBA  2.4.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TAO_Thread_Lane Class Reference

Class representing the thread lane inside a thread pool. More...

#include <Thread_Pool.h>

Collaboration diagram for TAO_Thread_Lane:
Collaboration graph
[legend]

Public Member Functions

 TAO_Thread_Lane (TAO_Thread_Pool &pool, CORBA::ULong id, CORBA::Short lane_priority, CORBA::ULong static_threads, CORBA::ULong dynamic_threads, TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan lifespan, ACE_Time_Value const &dynamic_thread_time)
 Constructor. More...
 
 ~TAO_Thread_Lane (void)
 Destructor. More...
 
void open (void)
 Open the lane. More...
 
void finalize (void)
 Finalize the resources. More...
 
void shutdown_reactor (void)
 Shutdown the reactor. More...
 
void wait (void)
 Wait for threads to exit. More...
 
int is_collocated (const TAO_MProfile &mprofile)
 Does mprofile belong to us? More...
 
int create_static_threads (void)
 Create the static threads - only called once. More...
 
void shutting_down (void)
 
bool new_dynamic_thread (void)
 

Private Member Functions

void validate_and_map_priority (void)
 Validate lane's priority and map it to a native value. More...
 
int create_threads_i (TAO_Thread_Pool_Threads &thread_pool, CORBA::ULong number_of_threads, long thread_flags)
 
int create_dynamic_threads (CORBA::ULong number_of_threads)
 

Private Attributes

TAO_Thread_Poolpool_
 The Thread Pool to which this lane belongs. More...
 
CORBA::ULong const id_
 The id of this lane. More...
 
CORBA::Short lane_priority_
 
bool shutdown_
 
CORBA::ULong const static_threads_number_
 Number of static threads. More...
 
CORBA::ULong const dynamic_threads_number_
 Maximum number of threads we are allowed to create. More...
 
TAO_Thread_Pool_Threads static_threads_
 Array with all static threads. More...
 
TAO_Dynamic_Thread_Pool_Threads dynamic_threads_
 Array with all dynamic threads. More...
 
TAO_RT_New_Leader_Generator new_thread_generator_
 
TAO_Thread_Lane_Resources resources_
 
CORBA::Short native_priority_
 
TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan const lifespan_
 
ACE_Time_Value const dynamic_thread_time_
 
TAO_SYNCH_MUTEX lock_
 Lock to guard all members of the lane. More...
 

Accessors

TAO_Thread_Poolpool (void) const
 
CORBA::ULong id (void) const
 
CORBA::Short lane_priority (void) const
 
CORBA::ULong static_threads (void) const
 
CORBA::ULong dynamic_threads (void) const
 
CORBA::ULong current_threads (void) const
 
CORBA::Short native_priority (void) const
 
TAO_Thread_Lane_Resourcesresources (void)
 
TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan lifespan (void) const
 
ACE_Time_Value const & dynamic_thread_time (void) const
 

Detailed Description

Class representing the thread lane inside a thread pool.

Constructor & Destructor Documentation

TAO_Thread_Lane::TAO_Thread_Lane ( TAO_Thread_Pool pool,
CORBA::ULong  id,
CORBA::Short  lane_priority,
CORBA::ULong  static_threads,
CORBA::ULong  dynamic_threads,
TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan  lifespan,
ACE_Time_Value const &  dynamic_thread_time 
)

Constructor.

TAO_Thread_Lane::~TAO_Thread_Lane ( void  )

Destructor.

Member Function Documentation

int TAO_Thread_Lane::create_dynamic_threads ( CORBA::ULong  number_of_threads)
private

Create number_of_threads of dynamic threads. Can be called multiple times.

int TAO_Thread_Lane::create_static_threads ( void  )

Create the static threads - only called once.

int TAO_Thread_Lane::create_threads_i ( TAO_Thread_Pool_Threads thread_pool,
CORBA::ULong  number_of_threads,
long  thread_flags 
)
private
CORBA::ULong TAO_Thread_Lane::current_threads ( void  ) const
ACE_Time_Value const & TAO_Thread_Lane::dynamic_thread_time ( void  ) const
inline
CORBA::ULong TAO_Thread_Lane::dynamic_threads ( void  ) const
inline
void TAO_Thread_Lane::finalize ( void  )

Finalize the resources.

CORBA::ULong TAO_Thread_Lane::id ( void  ) const
inline
int TAO_Thread_Lane::is_collocated ( const TAO_MProfile mprofile)

Does mprofile belong to us?

CORBA::Short TAO_Thread_Lane::lane_priority ( void  ) const
inline
TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan TAO_Thread_Lane::lifespan ( void  ) const
inline
CORBA::Short TAO_Thread_Lane::native_priority ( void  ) const
inline
bool TAO_Thread_Lane::new_dynamic_thread ( void  )

Called by the TAO_RT_New_Leader_Generator to request a new dynamic thread. It can be that no thread can be created because the number of threads is equal to the maximum we can have or the Thread Lane is shutting down.

Return values
trueA new thread is created
falseNo thread could be created
void TAO_Thread_Lane::open ( void  )

Open the lane.

TAO_Thread_Pool & TAO_Thread_Lane::pool ( void  ) const
inline
TAO_Thread_Lane_Resources & TAO_Thread_Lane::resources ( void  )
inline
void TAO_Thread_Lane::shutdown_reactor ( void  )

Shutdown the reactor.

void TAO_Thread_Lane::shutting_down ( void  )

Mark that this lane is shutting down, we then don't create any dynamic threads anymore. When the pool is shutting down the leader follower loop is called which can cause a request to create a new dynamic thread but we shouldn't create a new one.

CORBA::ULong TAO_Thread_Lane::static_threads ( void  ) const
inline
void TAO_Thread_Lane::validate_and_map_priority ( void  )
private

Validate lane's priority and map it to a native value.

void TAO_Thread_Lane::wait ( void  )

Wait for threads to exit.

Member Data Documentation

ACE_Time_Value const TAO_Thread_Lane::dynamic_thread_time_
private
TAO_Dynamic_Thread_Pool_Threads TAO_Thread_Lane::dynamic_threads_
private

Array with all dynamic threads.

CORBA::ULong const TAO_Thread_Lane::dynamic_threads_number_
private

Maximum number of threads we are allowed to create.

CORBA::ULong const TAO_Thread_Lane::id_
private

The id of this lane.

CORBA::Short TAO_Thread_Lane::lane_priority_
private
TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan const TAO_Thread_Lane::lifespan_
private
TAO_SYNCH_MUTEX TAO_Thread_Lane::lock_
mutableprivate

Lock to guard all members of the lane.

CORBA::Short TAO_Thread_Lane::native_priority_
private
TAO_RT_New_Leader_Generator TAO_Thread_Lane::new_thread_generator_
private
TAO_Thread_Pool& TAO_Thread_Lane::pool_
private

The Thread Pool to which this lane belongs.

TAO_Thread_Lane_Resources TAO_Thread_Lane::resources_
private
bool TAO_Thread_Lane::shutdown_
private

This boolean is set when we are shutting down, then we will not create any new dynamic threads

TAO_Thread_Pool_Threads TAO_Thread_Lane::static_threads_
private

Array with all static threads.

CORBA::ULong const TAO_Thread_Lane::static_threads_number_
private

Number of static threads.


The documentation for this class was generated from the following files: