Esempio n. 1
0
void scheduler_t::init() {
	sched_param sp = { priority };

	size_t i = 0;
	try {
		char const *fmt = log::number_fmt(threads);

		for(; i < threads; ++i) {
			string_t name = string_t::ctor_t(5).print(i, fmt);
			log::handler_t handler(name);

			bq_thrs[i].init(
				event_buf_size, timeout_prec, cont_count, tname, post_activate()
			);

			if(need_set_priority)
				if(sched_setscheduler(bq_thrs[i].get_tid(), policy, &sp) < 0)
					throw exception_sys_t(log::error, errno, "sched_setscheduler: %m");
		}
	}
	catch(...) {
		bq_thr_t::stop();

		bq_thrs[i].fini();

		while(i)
			bq_thrs[--i].fini();

		throw;
	}

	init_ext();
}
Esempio n. 2
0
int
MIF_Task::activate_task (RTScheduling::Current_ptr current,
       CORBA::Policy_ptr sched_param,
       long flags,
       ACE_Time_Value* base_time)
{

  if (TAO_debug_level > 0)
    ACE_DEBUG ((LM_DEBUG,
    "MIF_Task::activate %d\n",
    importance_));

  char msg [BUFSIZ];
  ACE_OS::sprintf (msg, "MIF_Task::activate task\n");
  dt_creator_->log_msg (msg);

  base_time_ = base_time;

  current_ = RTScheduling::Current::_narrow (current);

  sched_param_ = CORBA::Policy::_duplicate (sched_param);

  pre_activate ();

  if (this->activate (flags,
          1) == -1)
    {
      if (ACE_OS::last_error () == EPERM)
  ACE_ERROR_RETURN ((LM_ERROR,
         ACE_TEXT ("Insufficient privilege to run this test.\n")),
        -1);
    }

  post_activate ();
  return 0;
}