Class representing the thread pool inside a thread pool manager. More...
#include <Thread_Pool.h>
Public Member Functions | |
TAO_Thread_Pool (TAO_Thread_Pool_Manager &manager, CORBA::ULong id, CORBA::ULong stack_size, CORBA::ULong static_threads, CORBA::ULong dynamic_threads, CORBA::Short default_priority, CORBA::Boolean allow_request_buffering, CORBA::ULong max_buffered_requests, CORBA::ULong max_request_buffer_size, TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan lifespan, ACE_Time_Value const &dynamic_thread_time) | |
Constructor (for pools without lanes). | |
TAO_Thread_Pool (TAO_Thread_Pool_Manager &manager, CORBA::ULong id, CORBA::ULong stack_size, const RTCORBA::ThreadpoolLanes &lanes, CORBA::Boolean allow_borrowing, CORBA::Boolean allow_request_buffering, CORBA::ULong max_buffered_requests, CORBA::ULong max_request_buffer_size, TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan lifespan, ACE_Time_Value const &dynamic_thread_time) | |
Constructor (for pools with lanes). | |
~TAO_Thread_Pool (void) | |
Destructor. | |
void | open (void) |
Open the pool. | |
void | finalize (void) |
Finalize the resources. | |
void | shutdown_reactor (void) |
Shutdown the reactor. | |
void | wait (void) |
Wait for threads to exit. | |
void | shutting_down (void) |
Mark this thread pool that we are shutting down. | |
int | is_collocated (const TAO_MProfile &mprofile) |
Does mprofile belong to us? | |
int | create_static_threads (void) |
Create the static threads - only called once. | |
bool | with_lanes (void) const |
Check if this thread pool has (explicit) lanes. | |
Private Attributes | |
TAO_Thread_Pool_Manager & | manager_ |
CORBA::ULong | id_ |
CORBA::ULong | stack_size_ |
CORBA::Boolean | allow_borrowing_ |
CORBA::Boolean | allow_request_buffering_ |
CORBA::ULong | max_buffered_requests_ |
CORBA::ULong | max_request_buffer_size_ |
TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan const | lifespan_ |
ACE_Time_Value const | dynamic_thread_time_ |
TAO_Thread_Lane ** | lanes_ |
CORBA::ULong | number_of_lanes_ |
bool | with_lanes_ |
Accessors | |
| |
TAO_Thread_Pool_Manager & | manager (void) const |
CORBA::ULong | id (void) const |
CORBA::ULong | stack_size (void) const |
CORBA::Boolean | allow_borrowing (void) const |
CORBA::Boolean | allow_request_buffering (void) const |
CORBA::ULong | max_buffered_requests (void) const |
CORBA::ULong | max_request_buffer_size (void) const |
TAO_Thread_Lane ** | lanes (void) |
CORBA::ULong | number_of_lanes (void) const |
Class representing the thread pool inside a thread pool manager.
Definition at line 258 of file Thread_Pool.h.
TAO_Thread_Pool::TAO_Thread_Pool | ( | TAO_Thread_Pool_Manager & | manager, | |
CORBA::ULong | id, | |||
CORBA::ULong | stack_size, | |||
CORBA::ULong | static_threads, | |||
CORBA::ULong | dynamic_threads, | |||
CORBA::Short | default_priority, | |||
CORBA::Boolean | allow_request_buffering, | |||
CORBA::ULong | max_buffered_requests, | |||
CORBA::ULong | max_request_buffer_size, | |||
TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan | lifespan, | |||
ACE_Time_Value const & | dynamic_thread_time | |||
) |
Constructor (for pools without lanes).
Definition at line 485 of file Thread_Pool.cpp.
: manager_ (manager), id_ (id), stack_size_ (stack_size), allow_borrowing_ (0), allow_request_buffering_ (allow_request_buffering), max_buffered_requests_ (max_buffered_requests), max_request_buffer_size_ (max_request_buffer_size), lifespan_ (lifespan), dynamic_thread_time_ (dynamic_thread_time), lanes_ (0), number_of_lanes_ (1), with_lanes_ (false) { // No support for buffering. if (allow_request_buffering) throw ::CORBA::NO_IMPLEMENT (); // Create one lane. ACE_NEW (this->lanes_, TAO_Thread_Lane *[this->number_of_lanes_]); ACE_NEW (this->lanes_[0], TAO_Thread_Lane (*this, 0, default_priority, static_threads, dynamic_threads, lifespan, dynamic_thread_time )); }
TAO_Thread_Pool::TAO_Thread_Pool | ( | TAO_Thread_Pool_Manager & | manager, | |
CORBA::ULong | id, | |||
CORBA::ULong | stack_size, | |||
const RTCORBA::ThreadpoolLanes & | lanes, | |||
CORBA::Boolean | allow_borrowing, | |||
CORBA::Boolean | allow_request_buffering, | |||
CORBA::ULong | max_buffered_requests, | |||
CORBA::ULong | max_request_buffer_size, | |||
TAO_RT_ORBInitializer::TAO_RTCORBA_DT_LifeSpan | lifespan, | |||
ACE_Time_Value const & | dynamic_thread_time | |||
) |
Constructor (for pools with lanes).
Definition at line 527 of file Thread_Pool.cpp.
: manager_ (manager), id_ (id), stack_size_ (stack_size), allow_borrowing_ (allow_borrowing), allow_request_buffering_ (allow_request_buffering), max_buffered_requests_ (max_buffered_requests), max_request_buffer_size_ (max_request_buffer_size), lifespan_ (lifespan), dynamic_thread_time_ (dynamic_thread_time), lanes_ (0), number_of_lanes_ (lanes.length ()), with_lanes_ (true) { // No support for buffering or borrowing. if (allow_borrowing || allow_request_buffering) throw ::CORBA::NO_IMPLEMENT (); // Create multiple lane. ACE_NEW (this->lanes_, TAO_Thread_Lane *[this->number_of_lanes_]); for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) ACE_NEW (this->lanes_[i], TAO_Thread_Lane (*this, i, lanes[i].lane_priority, lanes[i].static_threads, lanes[i].dynamic_threads, lifespan, dynamic_thread_time )); }
TAO_Thread_Pool::~TAO_Thread_Pool | ( | void | ) |
Destructor.
Definition at line 584 of file Thread_Pool.cpp.
{ // Delete all the lanes. for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) delete this->lanes_[i]; delete[] this->lanes_; }
CORBA::Boolean TAO_Thread_Pool::allow_borrowing | ( | void | ) | const |
Definition at line 107 of file Thread_Pool.inl.
{ return this->allow_borrowing_; }
CORBA::Boolean TAO_Thread_Pool::allow_request_buffering | ( | void | ) | const |
Definition at line 114 of file Thread_Pool.inl.
{ return this->allow_request_buffering_; }
int TAO_Thread_Pool::create_static_threads | ( | void | ) |
Create the static threads - only called once.
Definition at line 655 of file Thread_Pool.cpp.
{ for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) { // Ask each lane to create its set of static threads. int const result = this->lanes_[i]->create_static_threads (); // Return on failure. if (result != 0) return result; } // Success. return 0; }
void TAO_Thread_Pool::finalize | ( | void | ) |
Finalize the resources.
Definition at line 596 of file Thread_Pool.cpp.
{ // Finalize all the lanes. for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) this->lanes_[i]->finalize (); }
CORBA::ULong TAO_Thread_Pool::id | ( | void | ) | const |
Definition at line 93 of file Thread_Pool.inl.
{ return this->id_; }
int TAO_Thread_Pool::is_collocated | ( | const TAO_MProfile & | mprofile | ) |
Does mprofile belong to us?
Definition at line 637 of file Thread_Pool.cpp.
{ // Finalize all the lanes. for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) { int result = this->lanes_[i]->is_collocated (mprofile); if (result) return result; } return 0; }
TAO_Thread_Lane ** TAO_Thread_Pool::lanes | ( | void | ) |
Definition at line 135 of file Thread_Pool.inl.
{ return this->lanes_; }
TAO_Thread_Pool_Manager & TAO_Thread_Pool::manager | ( | void | ) | const |
Definition at line 86 of file Thread_Pool.inl.
{ return this->manager_; }
CORBA::ULong TAO_Thread_Pool::max_buffered_requests | ( | void | ) | const |
Definition at line 121 of file Thread_Pool.inl.
{ return this->max_buffered_requests_; }
CORBA::ULong TAO_Thread_Pool::max_request_buffer_size | ( | void | ) | const |
Definition at line 128 of file Thread_Pool.inl.
{ return this->max_request_buffer_size_; }
CORBA::ULong TAO_Thread_Pool::number_of_lanes | ( | void | ) | const |
Definition at line 142 of file Thread_Pool.inl.
{ return this->number_of_lanes_; }
void TAO_Thread_Pool::open | ( | void | ) |
Open the pool.
Definition at line 573 of file Thread_Pool.cpp.
{ // Open all the lanes. for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) { this->lanes_[i]->open (); } }
void TAO_Thread_Pool::shutdown_reactor | ( | void | ) |
Shutdown the reactor.
Definition at line 606 of file Thread_Pool.cpp.
{ // Finalize all the lanes. for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) this->lanes_[i]->shutdown_reactor (); }
void TAO_Thread_Pool::shutting_down | ( | void | ) |
Mark this thread pool that we are shutting down.
Definition at line 616 of file Thread_Pool.cpp.
{ // Finalize all the lanes. for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) this->lanes_[i]->shutting_down (); }
CORBA::ULong TAO_Thread_Pool::stack_size | ( | void | ) | const |
Definition at line 100 of file Thread_Pool.inl.
{ return this->stack_size_; }
void TAO_Thread_Pool::wait | ( | void | ) |
Wait for threads to exit.
Definition at line 627 of file Thread_Pool.cpp.
{ // Finalize all the lanes. for (CORBA::ULong i = 0; i != this->number_of_lanes_; ++i) this->lanes_[i]->wait (); }
bool TAO_Thread_Pool::with_lanes | ( | void | ) | const |
Check if this thread pool has (explicit) lanes.
Definition at line 79 of file Thread_Pool.inl.
{ return this->with_lanes_; }
Definition at line 336 of file Thread_Pool.h.
Definition at line 337 of file Thread_Pool.h.
ACE_Time_Value const TAO_Thread_Pool::dynamic_thread_time_ [private] |
Definition at line 341 of file Thread_Pool.h.
CORBA::ULong TAO_Thread_Pool::id_ [private] |
Definition at line 333 of file Thread_Pool.h.
TAO_Thread_Lane** TAO_Thread_Pool::lanes_ [private] |
Definition at line 343 of file Thread_Pool.h.
Definition at line 340 of file Thread_Pool.h.
TAO_Thread_Pool_Manager& TAO_Thread_Pool::manager_ [private] |
Definition at line 332 of file Thread_Pool.h.
Definition at line 338 of file Thread_Pool.h.
Definition at line 339 of file Thread_Pool.h.
Definition at line 344 of file Thread_Pool.h.
CORBA::ULong TAO_Thread_Pool::stack_size_ [private] |
Definition at line 335 of file Thread_Pool.h.
bool TAO_Thread_Pool::with_lanes_ [private] |
Definition at line 345 of file Thread_Pool.h.