Public Member Functions | Private Attributes

DTTask Class Reference

#include <Current.h>

Inheritance diagram for DTTask:
Inheritance graph
[legend]
Collaboration diagram for DTTask:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DTTask (TAO_ORB_Core *orb, DT_Hash_Map *dt_hash, TAO_RTScheduler_Current_i *, RTScheduling::ThreadAction_ptr start, CORBA::VoidData data, const char *name, CORBA::Policy_ptr sched_param, CORBA::Policy_ptr implicit_sched_param)
virtual ~DTTask (void)
int activate_task (RTCORBA::Priority base_priority, CORBA::ULong stack_size)
virtual int svc (void)

Private Attributes

TAO_ORB_Coreorb_
DT_Hash_Mapdt_hash_
TAO_RTScheduler_Current_icurrent_
RTScheduling::ThreadAction_var start_
CORBA::VoidData data_
RTScheduling::Current::IdType guid_
CORBA::String_var name_
CORBA::Policy_var sched_param_
CORBA::Policy_var implicit_sched_param_

Detailed Description

Definition at line 307 of file Current.h.


Constructor & Destructor Documentation

DTTask::DTTask ( TAO_ORB_Core orb,
DT_Hash_Map dt_hash,
TAO_RTScheduler_Current_i new_current,
RTScheduling::ThreadAction_ptr  start,
CORBA::VoidData  data,
const char *  name,
CORBA::Policy_ptr  sched_param,
CORBA::Policy_ptr  implicit_sched_param 
)

Definition at line 577 of file Current.cpp.

  :orb_ (orb),
   dt_hash_ (dt_hash),
   current_ (new_current),
   start_ (RTScheduling::ThreadAction::_duplicate (start)),
   data_ (data),
   name_ (CORBA::string_dup (name)),
   sched_param_ (CORBA::Policy::_duplicate (sched_param)),
   implicit_sched_param_ (CORBA::Policy::_duplicate (implicit_sched_param))
{
}

DTTask::~DTTask ( void   )  [virtual]

Definition at line 596 of file Current.cpp.

{
  delete this->current_;
}


Member Function Documentation

int DTTask::activate_task ( RTCORBA::Priority  base_priority,
CORBA::ULong  stack_size 
)

Definition at line 530 of file Current.cpp.

{
  // Activate thread.
  long default_flags = THR_NEW_LWP | THR_JOINABLE;
  long flags =
    default_flags |
    this->orb_->orb_params ()->scope_policy () |
    this->orb_->orb_params ()->sched_policy ();

  CORBA::Object_var object =
    this->orb_->object_ref_table ().resolve_initial_reference (
    TAO_OBJID_PRIORITYMAPPINGMANAGER);

  RTCORBA::PriorityMappingManager_var mapping_manager =
    RTCORBA::PriorityMappingManager::_narrow (object.in ()
                                             );

  RTCORBA::PriorityMapping *pm =
    mapping_manager->mapping ();

  RTCORBA::NativePriority native_priority;
  pm->to_native (base_priority,
                 native_priority);

  size_t stack [1];
  stack [0] = stack_size;
  if (this->activate (flags,
                      1,
                      0,//force_active
                      native_priority,//priority
                      -1,//grp_id
                      0,//ACE_Task_Base
                      0,//thread_handles
                      0,//stack
                      stack//stack_size
                      ) == -1)
    {
      if (ACE_OS::last_error () == EPERM)
        ACE_ERROR_RETURN ((LM_ERROR,
                           ACE_TEXT ("Insufficient privilege to run this test.\n")),
                          -1);
    }
  return 0;
}

int DTTask::svc ( void   )  [virtual]

Reimplemented from ACE_Task_Base.

Definition at line 602 of file Current.cpp.

{
  try
    {

      TAO_TSS_Resources *tss =
        TAO_TSS_Resources::instance ();

      tss->rtscheduler_current_impl_ = this->current_;

      this->current_->begin_scheduling_segment (this->name_.in (),
                                                this->sched_param_.in (),
                                                this->implicit_sched_param_.in ()
                                               );

      // Invoke entry point into new DT.
      this->start_->_cxx_do (this->data_
                            );

      this->current_->end_scheduling_segment (this->name_.in ()
                                            );
    }
  catch (const ::CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Caught exception:");
      return -1;
    }

  return 0;
}


Member Data Documentation

Definition at line 329 of file Current.h.

CORBA::VoidData DTTask::data_ [private]

Definition at line 331 of file Current.h.

Definition at line 328 of file Current.h.

Definition at line 332 of file Current.h.

Definition at line 335 of file Current.h.

Definition at line 333 of file Current.h.

Definition at line 327 of file Current.h.

Definition at line 334 of file Current.h.

RTScheduling::ThreadAction_var DTTask::start_ [private]

Definition at line 330 of file Current.h.


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