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

📄 reconfig_scheduler_t.cpp

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

      // Call the internal set method.
      this->set_i (rt_info_ptr,
                   infos[i].criticality,
                   infos[i].worst_case_execution_time,
                   infos[i].typical_execution_time,
                   infos[i].cached_execution_time,
                   infos[i].period,
                   infos[i].importance,
                   infos[i].quantum,
                   infos[i].threads,
                   infos[i].info_type
                   ACE_ENV_ARG_PARAMETER);
      ACE_CHECK;
    }

  // Update stability flags.  For now, just mark everything as unstable.
  // @@ TODO - revisit this and see if we can efficiently detect when
  //           changes do not affect stability of various aspects.
          this->stability_flags_ |= SCHED_UTILIZATION_NOT_STABLE;
  this->stability_flags_ |= SCHED_PRIORITY_NOT_STABLE;
  this->stability_flags_ |= SCHED_PROPAGATION_NOT_STABLE;

  return;
}


template <class RECONFIG_SCHED_STRATEGY, class ACE_LOCK>
void
TAO_Reconfig_Scheduler<RECONFIG_SCHED_STRATEGY, ACE_LOCK>::
reset_seq (const RtecScheduler::RT_Info_Set& infos
           ACE_ENV_ARG_DECL)
     ACE_THROW_SPEC ((CORBA::SystemException,
                      RtecScheduler::UNKNOWN_TASK,
                      RtecScheduler::INTERNAL,
                      RtecScheduler::SYNCHRONIZATION_FAILURE))
{
#if defined (SCHEDULER_LOGGING)
  ACE_DEBUG ((LM_TRACE,
              " TAO_Reconfig_Scheduler::reset_seq.\n"));
#endif /* SCHEDULER_LOGGING */

  ACE_GUARD_THROW_EX (ACE_LOCK, ace_mon, this->mutex_,
                      RtecScheduler::SYNCHRONIZATION_FAILURE ());
  ACE_CHECK;

  TAO_RT_Info_Ex *rt_info_ptr = 0;
  u_int i;

  for (i = 0; i < infos.length (); ++i)
    {
      // Look up the RT_Info by its handle, throw an exception if it's not there.
      if (rt_info_map_.find (infos[i].handle, rt_info_ptr) != 0)
        {
          ACE_THROW (RtecScheduler::UNKNOWN_TASK ());
        }

      // Enable the RT_Info.  Does not modify NON_VOLATILE ops.
      if (rt_info_ptr->enabled_state () == RtecScheduler::RT_INFO_NON_VOLATILE)
        {
          ACE_THROW (RtecScheduler::UNKNOWN_TASK ());
        }
      else
        {
          // Reset the RT_Info.
          rt_info_ptr->reset (TAO_Reconfig_Scheduler_Entry::ORIGINAL
                              | TAO_Reconfig_Scheduler_Entry::PROPAGATED);

          rt_info_ptr->enabled_state (RtecScheduler::RT_INFO_ENABLED);
        }
    }

  // Refresh the internal tuple pointer array.
  this->refresh_tuple_ptr_array_i (ACE_ENV_SINGLE_ARG_PARAMETER);
  ACE_CHECK;

  for (i = 0; i < infos.length (); ++i)
    {
      // Look up the RT_Info by its handle, throw an exception if it's not there.
      if (rt_info_map_.find (infos[i].handle, rt_info_ptr) != 0)
        {
          ACE_THROW (RtecScheduler::UNKNOWN_TASK ());
        }

      if (rt_info_ptr == 0)
    {
          ACE_THROW (RtecScheduler::INTERNAL ());
        }

      // Call the internal set method.
      this->set_i (rt_info_ptr,
                   infos[i].criticality,
                   infos[i].worst_case_execution_time,
                   infos[i].typical_execution_time,
                   infos[i].cached_execution_time,
                   infos[i].period,
                   infos[i].importance,
                   infos[i].quantum,
                   infos[i].threads,
                   infos[i].info_type
                   ACE_ENV_ARG_PARAMETER);
      ACE_CHECK;
    }

  // Update stability flags.  For now, just mark everything as unstable.
  // @@ TODO - revisit this and see if we can efficiently detect when
  //           changes do not affect stability of various aspects.
  this->stability_flags_ |= SCHED_UTILIZATION_NOT_STABLE;
      this->stability_flags_ |= SCHED_PRIORITY_NOT_STABLE;
  this->stability_flags_ |= SCHED_PROPAGATION_NOT_STABLE;

  return;
}

template <class RECONFIG_SCHED_STRATEGY, class ACE_LOCK>
void
TAO_Reconfig_Scheduler<RECONFIG_SCHED_STRATEGY, ACE_LOCK>::
replace_seq (const RtecScheduler::RT_Info_Set& infos
             ACE_ENV_ARG_DECL)
     ACE_THROW_SPEC ((CORBA::SystemException,
                      RtecScheduler::UNKNOWN_TASK,
                      RtecScheduler::INTERNAL,
                      RtecScheduler::SYNCHRONIZATION_FAILURE))
{
#if defined (SCHEDULER_LOGGING)
  ACE_DEBUG ((LM_TRACE,
              " TAO_Reconfig_Scheduler::replace_seq.\n"));
#endif /* SCHEDULER_LOGGING */

  ACE_GUARD_THROW_EX (ACE_LOCK, ace_mon, this->mutex_,
                      RtecScheduler::SYNCHRONIZATION_FAILURE ());
  ACE_CHECK;

  TAO_RT_Info_Ex *rt_info_ptr = 0;

  for (ACE_TYPENAME RT_INFO_MAP::iterator info_iter (this->rt_info_map_);
       info_iter.done () == 0;
       ++info_iter)
    {
      // Get a pointer to each registered RT_Info.
      rt_info_ptr = (*info_iter).int_id_;
      if (! rt_info_ptr)
        {
          ACE_THROW (RtecScheduler::INTERNAL ());
        }

      switch (rt_info_ptr->enabled_state ())
        {
          case RtecScheduler::RT_INFO_ENABLED:

            // Disable enabled RT_Infos.
            rt_info_ptr->enabled_state (RtecScheduler::RT_INFO_DISABLED);

            // Reset Enabled and Non-Volatile RT_Infos.
            rt_info_ptr->reset (TAO_Reconfig_Scheduler_Entry::ORIGINAL
                                | TAO_Reconfig_Scheduler_Entry::PROPAGATED);
            break;

            // Intentional fall-through to ignore non-volatile RT_Infos
          case RtecScheduler::RT_INFO_NON_VOLATILE: 

          default:                             // Ignore disabled RT_Infos.
            break;
        }
    }

  // Zero out the tuple pointer array, set count to zero
  ACE_OS::memset (this->tuple_ptr_array_, 0,
                  sizeof (TAO_RT_Info_Tuple *)
                  * this->tuple_ptr_array_size_);
  this->rt_info_tuple_count_ = 0;

  for (u_int i = 0; i < infos.length (); ++i)
    {
      // Look up the RT_Info by its handle, throw an exception if it's not there.
      if (rt_info_map_.find (infos[i].handle, rt_info_ptr) != 0)
        {
          ACE_THROW (RtecScheduler::UNKNOWN_TASK ());
    }

      if (rt_info_ptr == 0)
    {
          ACE_THROW (RtecScheduler::INTERNAL ());
        }

      // Enable the RT_Info if it was disabled.  Does not modify NON_VOLATILE ops.
      if (rt_info_ptr->enabled_state () == RtecScheduler::RT_INFO_DISABLED)
        {
          rt_info_ptr->enabled_state (RtecScheduler::RT_INFO_ENABLED);
        }

      // Call the internal set method.
      this->set_i (rt_info_ptr,
                   infos[i].criticality,
                   infos[i].worst_case_execution_time,
                   infos[i].typical_execution_time,
                   infos[i].cached_execution_time,
                   infos[i].period,
                   infos[i].importance,
                   infos[i].quantum,
                   infos[i].threads,
                   infos[i].info_type
                   ACE_ENV_ARG_PARAMETER);
      ACE_CHECK;
    }

  // Update stability flags.  For now, just mark everything as unstable.
  // @@ TODO - revisit this and see if we can efficiently detect when
  //           changes do not affect stability of various aspects.
  this->stability_flags_ |= SCHED_UTILIZATION_NOT_STABLE;
  this->stability_flags_ |= SCHED_PRIORITY_NOT_STABLE;
  this->stability_flags_ |= SCHED_PROPAGATION_NOT_STABLE;

  return;
}


// Returns the priority and subpriority values assigned to an RT_Info,
// based on its handle.

template <class RECONFIG_SCHED_STRATEGY, class ACE_LOCK>
void
TAO_Reconfig_Scheduler<RECONFIG_SCHED_STRATEGY, ACE_LOCK>::
priority (RtecScheduler::handle_t handle,
          RtecScheduler::OS_Priority& o_priority,
          RtecScheduler::Preemption_Subpriority_t& subpriority,
          RtecScheduler::Preemption_Priority_t& p_priority
          ACE_ENV_ARG_DECL)
     ACE_THROW_SPEC ((CORBA::SystemException,
                      RtecScheduler::UNKNOWN_TASK,
                      RtecScheduler::SYNCHRONIZATION_FAILURE,
                      RtecScheduler::NOT_SCHEDULED))
{
  ACE_GUARD_THROW_EX (ACE_LOCK, ace_mon, this->mutex_,
                      RtecScheduler::SYNCHRONIZATION_FAILURE ());
  ACE_CHECK;

  // Check stability flags.
  if ((this->stability_flags_ & SCHED_PRIORITY_NOT_STABLE)
      && this->enforce_schedule_stability_)
    {
      ACE_THROW (RtecScheduler::NOT_SCHEDULED ());
    }

  // CDG - TBD - address priority "generations" i.e., after an
  // adaptive transition.  For now, go ahead and return whatever
  // priority is there, even if the RT_Info_Ex is disabled.

  TAO_RT_Info_Ex *rt_info = 0;
  if (rt_info_map_.find (handle, rt_info) != 0)
    {
      ACE_THROW (RtecScheduler::UNKNOWN_TASK ());
    }

  o_priority = rt_info->priority;
  subpriority = rt_info->preemption_subpriority;
  p_priority = rt_info->preemption_priority;
}


// Returns the priority and subpriority values assigned to an RT_Info,
// based on its entry point name.

template <class RECONFIG_SCHED_STRATEGY, class ACE_LOCK>
void
TAO_Reconfig_Scheduler<RECONFIG_SCHED_STRATEGY, ACE_LOCK>::
entry_point_priority (const char * entry_point,
                      RtecScheduler::OS_Priority& priority,
                      RtecScheduler::Preemption_Subpriority_t& subpriority,
                      RtecScheduler::Preemption_Priority_t& p_priority
                      ACE_ENV_ARG_DECL)
     ACE_THROW_SPEC ((CORBA::SystemException,
                      RtecScheduler::UNKNOWN_TASK,
                      RtecScheduler::SYNCHRONIZATION_FAILURE,
                      RtecScheduler::NOT_SCHEDULED))
{
#if defined (SCHEDULER_LOGGING)
  ACE_DEBUG ((LM_TRACE,
              " TAO_Reconfig_Scheduler::entry_point_priority.\n"));
#endif /* SCHEDULER_LOGGING */

  ACE_GUARD_THROW_EX (ACE_LOCK, ace_mon, this->mutex_,
                      RtecScheduler::SYNCHRONIZATION_FAILURE ());
  ACE_CHECK;

  RtecScheduler::handle_t handle =
    this->lookup_i (entry_point ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  this->priority_i (handle,
                  priority,
                  subpriority,
                  p_priority
                  ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
}


// This method registers a dependency between two RT_Infos.

template <class RECONFIG_SCHED_STRATEGY, class ACE_LOCK>
void
TAO_Reconfig_Scheduler<RECONFIG_SCHED_STRATEGY, ACE_LOCK>::
add_dependency (RtecScheduler::handle_t handle /* RT_Info that has the dependency */,
                RtecScheduler::handle_t dependency /* RT_Info on which it depends */,
                CORBA::Long number_of_calls,
                RtecScheduler::Dependency_Type_t dependency_type
                ACE_ENV_ARG_DECL)
     ACE_THROW_SPEC ((CORBA::SystemException,
                      RtecScheduler::SYNCHRONIZATION_FAILURE,
                      RtecScheduler::UNKNOWN_TASK))
{
#if defined (SCHEDULER_LOGGING)
  ACE_DEBUG ((LM_TRACE,
              " TAO_Reconfig_Scheduler::add_dependency.\n"));
#endif /* SCHEDULER_LOGGING */

  ACE_GUARD_THROW_EX (ACE_LOCK, ace_mon, this->mutex_,
                      RtecScheduler::SYNCHRONIZATION_FAILURE ());
  ACE_CHECK;

  // Delegate to the internal method.
  add_dependency_i (handle, dependency, number_of_calls, dependency_type,
                    RtecBase::DEPENDENCY_ENABLED ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // Since the call graph topology has changed, set *all*
  // stability flags before incrementing the dependency count.
  this->stability_flags_ |= SCHED_UTILIZATION_NOT_STABLE;
  ++dependency_count_;
}


// This method removes a dependency between two RT_Infos.

template <class RECONFIG_SCHED_STRATEGY, class ACE_LOCK>
void
TAO_Reconfig_Scheduler<RECONFIG_SCHED_STRATEGY, ACE_LOCK>::
remove_dependency (RtecScheduler::handle_t handle,
                   RtecScheduler::handle_t dependency,
                   CORBA::Long number_of_calls,
                   RtecScheduler::Dependency_Type_t dependency_type
                   ACE_ENV_ARG_DECL)
     ACE_THROW_SPEC ((CORBA::SystemException,
                      RtecScheduler::SYNCHRONIZATION_FAILURE,
                      RtecScheduler::UNKNOWN_TASK))
{
#if defined (SCHEDULER_LOGGING)
  ACE_DEBUG ((LM_TRACE,
              " TAO_Reconfig_Scheduler::remove_dependency.\n"));
#endif /* SCHEDULER_LOGGING */

  ACE_GUARD_THROW_EX (ACE_LOCK, ace_mon, this->mutex_,
                      RtecScheduler::SYNCHRONIZATION_FAILURE ());
  ACE_CHECK;

  // Delegate to the internal method.
  remove_dependency_i (handle, dependency, number_of_calls,
                       dependency_type ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // Since the call graph topology has changed, set *all*
  // stability flags before incrementing the dependency count.

⌨️ 快捷键说明

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