#include <Current.h>

Public Member Functions | |
| TAO_RTScheduler_Current_i (TAO_ORB_Core *orb, DT_Hash_Map *dt_hash) | |
| TAO_RTScheduler_Current_i (TAO_ORB_Core *orb, DT_Hash_Map *dt_hash, RTScheduling::Current::IdType guid, const char *name, CORBA::Policy_ptr sched_param, CORBA::Policy_ptr implicit_sched_param, RTScheduling::DistributableThread_ptr dt, TAO_RTScheduler_Current_i *prev_current) | |
| virtual | ~TAO_RTScheduler_Current_i (void) |
| virtual RTScheduling::DistributableThread_ptr | spawn (RTScheduling::ThreadAction_ptr start, CORBA::VoidData data, const char *name, CORBA::Policy_ptr sched_param, CORBA::Policy_ptr implicit_sched_param, CORBA::ULong stack_size, RTCORBA::Priority base_priority) |
| virtual void | begin_scheduling_segment (const char *name, CORBA::Policy_ptr sched_param, CORBA::Policy_ptr implicit_sched_param) |
| virtual void | update_scheduling_segment (const char *name, CORBA::Policy_ptr sched_param, CORBA::Policy_ptr implicit_sched_param) |
| virtual void | end_scheduling_segment (const char *name) |
| virtual RTScheduling::Current::IdType * | id (void) |
| void | id (RTScheduling::Current::IdType guid) |
| virtual CORBA::Policy_ptr | scheduling_parameter (void) |
| virtual CORBA::Policy_ptr | implicit_scheduling_parameter (void) |
| void | scheduling_parameter (CORBA::Policy_ptr) |
| void | implicit_scheduling_parameter (CORBA::Policy_ptr) |
| virtual RTScheduling::Current::NameList * | current_scheduling_segment_names (void) |
| void | cancel_thread (void) |
| void | cleanup_DT (void) |
| void | cleanup_current (void) |
| void | delete_all_currents (void) |
| const char * | name (void) |
| void | name (const char *) |
| TAO_ORB_Core * | orb (void) |
| RTScheduling::Scheduler_ptr | scheduler (void) |
| DT_Hash_Map * | dt_hash (void) |
| RTScheduling::DistributableThread_ptr | DT (void) |
| void | DT (RTScheduling::DistributableThread_ptr) |
Private Attributes | |
| RTScheduling::Scheduler_var | scheduler_ |
| TAO_ORB_Core * | orb_ |
| RTScheduling::Current::IdType | guid_ |
| CORBA::String_var | name_ |
| CORBA::Policy_var | sched_param_ |
| CORBA::Policy_var | implicit_sched_param_ |
| RTScheduling::DistributableThread_var | dt_ |
| TAO_RTScheduler_Current_i * | previous_current_ |
| DT_Hash_Map * | dt_hash_ |
Definition at line 219 of file Current.h.
| TAO_RTScheduler_Current_i::TAO_RTScheduler_Current_i | ( | TAO_ORB_Core * | orb, | |
| DT_Hash_Map * | dt_hash | |||
| ) |
Definition at line 271 of file Current.cpp.
:orb_ (orb), dt_ (RTScheduling::DistributableThread::_nil ()), previous_current_ (0), dt_hash_ (dt_hash) { CORBA::Object_var scheduler_obj = this->orb_->object_ref_table ().resolve_initial_reference ( "RTScheduler"); this->scheduler_ = RTScheduling::Scheduler::_narrow (scheduler_obj.in ()); }
| TAO_RTScheduler_Current_i::TAO_RTScheduler_Current_i | ( | TAO_ORB_Core * | orb, | |
| DT_Hash_Map * | dt_hash, | |||
| RTScheduling::Current::IdType | guid, | |||
| const char * | name, | |||
| CORBA::Policy_ptr | sched_param, | |||
| CORBA::Policy_ptr | implicit_sched_param, | |||
| RTScheduling::DistributableThread_ptr | dt, | |||
| TAO_RTScheduler_Current_i * | prev_current | |||
| ) |
Definition at line 285 of file Current.cpp.
: orb_ (orb), guid_ (guid), name_ (CORBA::string_dup (name)), sched_param_ (CORBA::Policy::_duplicate (sched_param)), implicit_sched_param_ (CORBA::Policy::_duplicate (implicit_sched_param)), dt_ (RTScheduling::DistributableThread::_duplicate (dt)), previous_current_ (prev_current), dt_hash_ (dt_hash) { CORBA::Object_var scheduler_obj = orb->object_ref_table ().resolve_initial_reference ( "RTScheduler"); this->scheduler_ = RTScheduling::Scheduler::_narrow (scheduler_obj.in () ); }
| TAO_RTScheduler_Current_i::~TAO_RTScheduler_Current_i | ( | void | ) | [virtual] |
Definition at line 311 of file Current.cpp.
{
}
| void TAO_RTScheduler_Current_i::begin_scheduling_segment | ( | const char * | name, | |
| CORBA::Policy_ptr | sched_param, | |||
| CORBA::Policy_ptr | implicit_sched_param | |||
| ) | [virtual] |
Definition at line 316 of file Current.cpp.
{
// Check if it is a new Scheduling Segmnet
if (this->guid_.length () == 0)
{
//Generate GUID
size_t temp = ++TAO_RTScheduler_Current::guid_counter;
this->guid_.length (sizeof(size_t));
ACE_OS::memcpy (this->guid_.get_buffer (),
&temp,
sizeof(size_t));
size_t guid;
ACE_OS::memcpy (&guid,
this->guid_.get_buffer (),
this->guid_.length ());
// Inform the scheduler of the new scheduling segment.
this->scheduler_->begin_new_scheduling_segment (this->guid_,
name,
sched_param,
implicit_sched_param
);
if (CORBA::is_nil (this->dt_.in ()))
//Create new DT.
this->dt_ = TAO_DistributableThread_Factory::create_DT ();
//Add new DT to map
int result = this->dt_hash_->bind (this->guid_,
this->dt_);
// Error in binding to the map - cancel thread.
if (result != 0)
{
this->cancel_thread ();
}
// Remember parameters for the scheduling segment.
this->name_ = CORBA::string_dup (name);
this->sched_param_ = CORBA::Policy::_duplicate (sched_param);
this->implicit_sched_param_ = CORBA::Policy::_duplicate (implicit_sched_param);
}
else //Nested segment
{
// Check current DT state.
if (this->dt_->state () == RTScheduling::DistributableThread::CANCELLED)
{
this->cancel_thread ();
}
// Inform scheduler of start of nested scheduling segment.
this->scheduler_->begin_nested_scheduling_segment
(this->guid_,
name,
sched_param,
implicit_sched_param
);
TAO_TSS_Resources *tss =
TAO_TSS_Resources::instance ();
TAO_RTScheduler_Current_i* new_current = 0;
ACE_NEW_THROW_EX (new_current,
TAO_RTScheduler_Current_i (this->orb_,
this->dt_hash_,
this->guid_,
name,
sched_param,
implicit_sched_param,
this->dt_.in (),
this),
CORBA::NO_MEMORY (
CORBA::SystemException::_tao_minor_code (
TAO::VMCID,
ENOMEM),
CORBA::COMPLETED_NO));
tss->rtscheduler_current_impl_ = new_current;
}
}
| void TAO_RTScheduler_Current_i::cancel_thread | ( | void | ) |
Definition at line 685 of file Current.cpp.
{
size_t guid;
ACE_OS::memcpy (&guid,
this->guid_.get_buffer (),
this->guid_.length ());
ACE_DEBUG ((LM_DEBUG,
"Distributable Thread - %d is cancelled\n",
guid));
// Let the scheduler know that the thread has
// been cancelled.
this->scheduler_->cancel (this->guid_
);
this->cleanup_DT ();
// Remove all related nested currents.
this->delete_all_currents ();
// Throw exception.
throw ::CORBA::THREAD_CANCELLED ();
}
| void TAO_RTScheduler_Current_i::cleanup_current | ( | void | ) |
Definition at line 718 of file Current.cpp.
{
TAO_TSS_Resources *tss =
TAO_TSS_Resources::instance ();
tss->rtscheduler_current_impl_ = this->previous_current_;
// Delete this current.
delete this;
}
| void TAO_RTScheduler_Current_i::cleanup_DT | ( | void | ) |
Definition at line 711 of file Current.cpp.
| RTScheduling::Current::NameList * TAO_RTScheduler_Current_i::current_scheduling_segment_names | ( | void | ) | [virtual] |
Definition at line 655 of file Current.cpp.
{
RTScheduling::Current::NameList* name_list;
ACE_NEW_RETURN (name_list,
RTScheduling::Current::NameList,
0);
TAO_RTScheduler_Current_i* current = this;
for (int index = 0; current != 0; index++)
{
name_list->length (index+1);
(*name_list) [index] = current->name ();
current = current->previous_current_;
}
return name_list;
}
| void TAO_RTScheduler_Current_i::delete_all_currents | ( | void | ) |
Definition at line 730 of file Current.cpp.
{
TAO_RTScheduler_Current_i* current = this;
while (current != 0)
{
TAO_RTScheduler_Current_i* prev_current = current->previous_current_;
current->cleanup_current ();
current = prev_current;
}
TAO_TSS_Resources *tss =
TAO_TSS_Resources::instance ();
tss->rtscheduler_current_impl_ = tss->rtscheduler_previous_current_impl_;
}
| RTScheduling::DistributableThread_ptr TAO_RTScheduler_Current_i::DT | ( | void | ) |
Definition at line 760 of file Current.cpp.
{
return this->dt_._retn ();
}
| void TAO_RTScheduler_Current_i::DT | ( | RTScheduling::DistributableThread_ptr | dt | ) |
Definition at line 766 of file Current.cpp.
{
this->dt_ = RTScheduling::DistributableThread::_duplicate (dt);
}
| DT_Hash_Map * TAO_RTScheduler_Current_i::dt_hash | ( | void | ) |
Definition at line 260 of file Current.cpp.
{
return this->dt_hash_;
}
| void TAO_RTScheduler_Current_i::end_scheduling_segment | ( | const char * | name | ) | [virtual] |
Definition at line 429 of file Current.cpp.
{
// Check if DT has been cancelled
if (this->dt_->state () == RTScheduling::DistributableThread::CANCELLED)
{
this->cancel_thread ();
}
if (this->previous_current_ == 0)
{
// Let the scheduler know that the DT is
// terminating.
this->scheduler_->end_scheduling_segment(this->guid_,
name
);
// Cleanup DT.
this->cleanup_DT ();
// Cleanup current.
this->cleanup_current ();
// A Nested segment.
} else {
// Inform scheduler of end of nested
// scheduling segment.
this->scheduler_->end_nested_scheduling_segment (this->guid_,
name,
this->previous_current_->sched_param_.in ()
);
// Cleanup current.
this->cleanup_current ();
}
}
| void TAO_RTScheduler_Current_i::id | ( | RTScheduling::Current::IdType | guid | ) |
Definition at line 748 of file Current.cpp.
{
this->guid_ = guid;
}
| RTScheduling::Current::IdType * TAO_RTScheduler_Current_i::id | ( | void | ) | [virtual] |
Definition at line 634 of file Current.cpp.
{
RTScheduling::Current::IdType_var guid = this->guid_;
return guid._retn ();
}
| void TAO_RTScheduler_Current_i::implicit_scheduling_parameter | ( | CORBA::Policy_ptr | implicit_sched_param | ) |
Definition at line 778 of file Current.cpp.
{
this->implicit_sched_param_ = CORBA::Policy::_duplicate (implicit_sched_param);
}
| CORBA::Policy_ptr TAO_RTScheduler_Current_i::implicit_scheduling_parameter | ( | void | ) | [virtual] |
Definition at line 649 of file Current.cpp.
{
return CORBA::Policy::_duplicate (this->implicit_sched_param_.in ());
}
| const char * TAO_RTScheduler_Current_i::name | ( | void | ) |
Definition at line 675 of file Current.cpp.
{
return this->name_.in ();
}
| void TAO_RTScheduler_Current_i::name | ( | const char * | name | ) |
Definition at line 754 of file Current.cpp.
{
this->name_ = CORBA::string_dup (name);
}
| TAO_ORB_Core * TAO_RTScheduler_Current_i::orb | ( | void | ) |
Definition at line 254 of file Current.cpp.
{
return this->orb_;
}
| RTScheduling::Scheduler_ptr TAO_RTScheduler_Current_i::scheduler | ( | void | ) |
Definition at line 266 of file Current.cpp.
{
return RTScheduling::Scheduler::_duplicate (this->scheduler_.in ());
}
| void TAO_RTScheduler_Current_i::scheduling_parameter | ( | CORBA::Policy_ptr | sched_param | ) |
Definition at line 772 of file Current.cpp.
{
this->sched_param_ = CORBA::Policy::_duplicate (sched_param);
}
| CORBA::Policy_ptr TAO_RTScheduler_Current_i::scheduling_parameter | ( | void | ) | [virtual] |
Definition at line 643 of file Current.cpp.
{
return CORBA::Policy::_duplicate (this->sched_param_.in ());
}
| RTScheduling::DistributableThread_ptr TAO_RTScheduler_Current_i::spawn | ( | RTScheduling::ThreadAction_ptr | start, | |
| CORBA::VoidData | data, | |||
| const char * | name, | |||
| CORBA::Policy_ptr | sched_param, | |||
| CORBA::Policy_ptr | implicit_sched_param, | |||
| CORBA::ULong | stack_size, | |||
| RTCORBA::Priority | base_priority | |||
| ) | [virtual] |
Definition at line 471 of file Current.cpp.
{
// Check if DT has been cancelled.
if (this->dt_->state () == RTScheduling::DistributableThread::CANCELLED)
{
this->cancel_thread ();
}
// Create new task for new DT.
DTTask *dttask = 0;
// If no scheduling parameter is specified then use the current
// implicit scheduling parameter as the scheduling parameter
if (sched_param == 0)
sched_param = this->implicit_sched_param_.in ();
RTScheduling::DistributableThread_var dt = TAO_DistributableThread_Factory::create_DT ();
TAO_RTScheduler_Current_i *new_current = 0;
ACE_NEW_RETURN (new_current,
TAO_RTScheduler_Current_i (this->orb_,
this->dt_hash_),
0);
new_current->DT (dt.in ());
ACE_NEW_RETURN (dttask,
DTTask (//thread_manager_,
this->orb_,
this->dt_hash_,
new_current,
start,
data,
name,
sched_param,
implicit_sched_param),
0);
if (dttask->activate_task (base_priority,
stack_size) == -1)
{
ACE_ERROR((LM_ERROR,
"Unable to activate DistributableThread\n"));
delete dttask;
return RTScheduling::DistributableThread::_nil ();
}
return dt._retn ();
}
| void TAO_RTScheduler_Current_i::update_scheduling_segment | ( | const char * | name, | |
| CORBA::Policy_ptr | sched_param, | |||
| CORBA::Policy_ptr | implicit_sched_param | |||
| ) | [virtual] |
Definition at line 404 of file Current.cpp.
{
// Check if DT has been cancelled
if (this->dt_->state () == RTScheduling::DistributableThread::CANCELLED)
{
this->cancel_thread ();
}
// Let scheduler know of the updates.
this->scheduler_->update_scheduling_segment (this->guid_,
name,
sched_param,
implicit_sched_param
);
// Remember the new values.
this->name_ = CORBA::string_dup (name);
this->sched_param_ = CORBA::Policy::_duplicate (sched_param);
this->implicit_sched_param_ = CORBA::Policy::_duplicate (implicit_sched_param);
}
RTScheduling::DistributableThread_var TAO_RTScheduler_Current_i::dt_ [private] |
DT_Hash_Map* TAO_RTScheduler_Current_i::dt_hash_ [private] |
TAO_ORB_Core* TAO_RTScheduler_Current_i::orb_ [private] |
RTScheduling::Scheduler_var TAO_RTScheduler_Current_i::scheduler_ [private] |
1.7.0