⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config_scheduler.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    }

  switch (severity)
    {
      // On a fatal anomaly abort without generating a schedule.
      case RtecScheduler::ANOMALY_FATAL:
        // TODO: throw something.
        ACE_ERROR ((LM_ERROR, "Schedule failed due to FATAL anomaly.\n"));
        return;

      // Otherwise, make sure we didn't get a fatal return type.
      default:
        switch (schedule_status)
        {
          case BaseSchedImplType::ST_BAD_INTERNAL_POINTER :
            // TODO: throw something.
            ACE_ERROR ((LM_ERROR,
                        "Schedule failed due to bad internal pointer.\n"));
            return;

          case BaseSchedImplType::ST_VIRTUAL_MEMORY_EXHAUSTED :
            // TODO: throw something.
            ACE_ERROR ((LM_ERROR,
                        "Schedule failed due to insufficient memory.\n"));
            return;

          case BaseSchedImplType::THREAD_COUNT_MISMATCH :
            // TODO: throw something.
            ACE_ERROR ((LM_ERROR,
                        "Schedule failed due to thread count mismatch.\n"));
            return;

          case BaseSchedImplType::TASK_COUNT_MISMATCH :
            // TODO: throw something.
            ACE_ERROR ((LM_ERROR,
                        "Schedule failed due to task count mismatch.\n"));
            return;

          // Otherwise, go ahead and generate a schedule.
          default:
            break;
        }
        break;
    }

  // return the set of scheduled RT_Infos
  if (infos.ptr () == 0)
    {
      infos = new RtecScheduler::RT_Info_Set (impl->tasks ());
    }
  infos->length (impl->tasks ());
  for (RtecScheduler::handle_t handle = 1;
       handle <= ACE_static_cast (RtecScheduler::handle_t, impl->tasks ());
       ++handle)
    {
      RtecScheduler::RT_Info* rt_info = 0;
      switch (impl->lookup_rt_info (handle, rt_info))
        {
        case BaseSchedImplType::SUCCEEDED:
          // We know that handles start at 1.
          infos[ACE_static_cast (CORBA::ULong, handle - 1)] = *rt_info;
          break;
        case BaseSchedImplType::FAILED:
        case BaseSchedImplType::ST_UNKNOWN_TASK:
        default:
          ACE_ERROR ((LM_ERROR,
                      "Config_Scheduler::schedule - lookup_rt_info failed\n"));
          // TODO: throw something.
          break;
        }
    }

  // return the set of scheduled Config_Infos
  if (configs.ptr () == 0)
    {
      configs =
        new RtecScheduler::Config_Info_Set(impl->minimum_priority_queue () + 1);
    }
  configs->length (impl->minimum_priority_queue () + 1);
  for (RtecScheduler::Preemption_Priority_t priority = 0;
       priority <=
         ACE_static_cast (RtecScheduler::Preemption_Priority_t,
                          impl->minimum_priority_queue ());
       ++priority)
    {
      RtecScheduler::Config_Info* config_info = 0;
      switch (impl->lookup_config_info (priority, config_info))
        {
        case BaseSchedImplType::SUCCEEDED:
          // We know that handles start at 1.
          configs[CORBA::ULong(priority)] = *config_info;
          break;
        case BaseSchedImplType::FAILED:
        case BaseSchedImplType::ST_UNKNOWN_TASK:
        default:
          ACE_ERROR ((LM_ERROR,
                      "Config_Scheduler::schedule - "
                      "lookup_config_info failed\n"));
          // TODO: throw something.
          break;
        }
    }

  ACE_DEBUG ((LM_DEBUG, "Schedule prepared.\n"));
  ACE_DEBUG ((LM_DEBUG, "Dumping to stdout.\n"));
  ACE_Scheduler_Factory::dump_schedule (*(infos.ptr()),
                                        *(dependencies.ptr()),
                                        *(configs.ptr()),
                                        *(anomalies.ptr()), 0);
  ACE_DEBUG ((LM_DEBUG, "Dump done.\n"));
}


void ACE_Config_Scheduler::dispatch_configuration (RtecScheduler::Preemption_Priority_t p_priority,
                                                   RtecScheduler::OS_Priority& priority,
                                                   RtecScheduler::Dispatching_Type_t & d_type
                                                   ACE_ENV_ARG_DECL_NOT_USED)
    ACE_THROW_SPEC ((CORBA::SystemException,
                    RtecScheduler::NOT_SCHEDULED,
                    RtecScheduler::UNKNOWN_PRIORITY_LEVEL))
{

  if (impl->dispatch_configuration (p_priority, priority, d_type) == -1)
    {
      ACE_ERROR ((LM_ERROR,
                  "Config_Scheduler::dispatch_configuration -"
                  " dispatch_configuration failed\n"));
      // TODO: throw something.
    }
}
  // provide the thread priority and queue type for the given priority level


RtecScheduler::Preemption_Priority_t
ACE_Config_Scheduler::last_scheduled_priority (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
    ACE_THROW_SPEC ((CORBA::SystemException,
                    RtecScheduler::NOT_SCHEDULED))
{

  RtecScheduler::Preemption_Priority_t priority = impl->minimum_priority_queue ();

  if (priority < 0)
    {
      ACE_ERROR ((LM_ERROR,
                  "Config_Scheduler::last_scheduled_priority - priorities failed\n"));
      // TODO: throw something.
    }

  return priority;
}
  // Returns the last priority number assigned to an operation in the schedule.
  // The number returned is one less than the total number of scheduled priorities.
  // All scheduled priorities range from 0 to the number returned, inclusive.

void
ACE_Config_Scheduler::get_config_infos (RtecScheduler::Config_Info_Set_out configs
                                         ACE_ENV_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::NOT_SCHEDULED))
{
  ACE_UNUSED_ARG ((configs));

  //TODO: fill the Config_Info_Set with the runtime Config_Infos
  //for now, this function is unimplemented
  return;
}

void ACE_Config_Scheduler::reset (RtecScheduler::handle_t,
            RtecScheduler::Criticality_t,
            RtecScheduler::Time,
            RtecScheduler::Time,
            RtecScheduler::Time,
            RtecScheduler::Period_t,
            RtecScheduler::Importance_t,
            RtecScheduler::Quantum_t,
            CORBA::Long,
            RtecScheduler::Info_Type_t
            ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::UNKNOWN_TASK,
                   RtecScheduler::INTERNAL,
                   RtecScheduler::SYNCHRONIZATION_FAILURE))
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::set_seq (const RtecScheduler::RT_Info_Set&
                      ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::UNKNOWN_TASK,
                   RtecScheduler::INTERNAL,
                   RtecScheduler::SYNCHRONIZATION_FAILURE))
// Set characteristics of the RT_Infos corresponding to the passed handles.
// Tuples are added in the case of existing and/or multiple definitions.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::reset_seq (const RtecScheduler::RT_Info_Set&
                        ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::UNKNOWN_TASK,
                   RtecScheduler::INTERNAL,
                   RtecScheduler::SYNCHRONIZATION_FAILURE))
// Reset characteristics of the RT_Infos corresponding to the passed handles.
// Tuples are replaced in the case of existing and/or multiple definitions.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::replace_seq (const RtecScheduler::RT_Info_Set&
                          ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::UNKNOWN_TASK,
                   RtecScheduler::INTERNAL,
                   RtecScheduler::SYNCHRONIZATION_FAILURE))
// Replace all RT_Infos, resetting characteristics of the RT_Infos
// corresponding to the passed handles.  All other RT_Infos are
// reset to their uninitialized values, i.e., the same they have
// just after the create call.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::remove_dependency (RtecScheduler::handle_t,
                                RtecScheduler::handle_t,
                                CORBA::Long,
                                RtecScheduler::Dependency_Type_t
                                ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::UNKNOWN_TASK))
// This method removes a dependency between two RT_Infos.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::set_dependency_enable_state (RtecScheduler::handle_t,
                                  RtecScheduler::handle_t,
                                  CORBA::Long,
                                  RtecScheduler::Dependency_Type_t,
                                  RtecScheduler::Dependency_Enabled_Type_t
                                  ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::UNKNOWN_TASK))
// This method sets the enable state of a dependency between two RT_Infos.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::set_dependency_enable_state_seq (const RtecScheduler::Dependency_Set &
                                      ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::UNKNOWN_TASK))
// This method sets the enable state of a sequence of dependencies.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::set_rt_info_enable_state (RtecScheduler::handle_t,
                               RtecScheduler::RT_Info_Enabled_Type_t
                                       ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::UNKNOWN_TASK))
// This method enables or disables an RT_Info.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::set_rt_info_enable_state_seq (
                  const RtecScheduler::RT_Info_Enable_State_Pair_Set &
                  ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::UNKNOWN_TASK))
// This method enables or disables a sequence of RT_Infos.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::recompute_scheduling (CORBA::Long,
                           CORBA::Long,
                           RtecScheduler::Scheduling_Anomaly_Set_out
                           ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::UTILIZATION_BOUND_EXCEEDED,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::INSUFFICIENT_THREAD_PRIORITY_LEVELS,
                   RtecScheduler::TASK_COUNT_MISMATCH,
                   RtecScheduler::INTERNAL,
                   RtecScheduler::DUPLICATE_NAME))
// Recomputes the scheduling priorities, etc.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::get_rt_info_set (RtecScheduler::RT_Info_Set_out
                              ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::INTERNAL))
// Returns the set of rt_infos, with their assigned priorities (as
// of the last schedule re-computation).
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::get_dependency_set (RtecScheduler::Dependency_Set_out
                                 ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::INTERNAL))
// Returns the set of rt_infos, with their assigned priorities (as
// of the last schedule re-computation).
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

void ACE_Config_Scheduler::get_config_info_set (RtecScheduler::Config_Info_Set_out
                                  ACE_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   RtecScheduler::SYNCHRONIZATION_FAILURE,
                   RtecScheduler::INTERNAL))
// Returns the set of config_infos, describing the appropriate
// number, types, and priority levels for the dispatching lanes.
{
  ACE_THROW (CORBA::NO_IMPLEMENT ());
}

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_DNode<TAO_RT_Info_Tuple *>;
#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_DNode<TAO_RT_Info_Tuple *>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -