5 #include "hrpsys/io/iob.h" 17 #define MAX_SAFE_STACK (8*1024) 31 #ifndef OPENRTM_VERSION_TRUNK 34 : RTC_exp::PeriodicExecutionContext(),
38 m_thread_pending (
false)
41 rtclog.setName(
"hrpEC");
45 getProperty(prop,
"exec_cxt.periodic.priority", m_priority);
46 getProperty(prop,
"exec_cxt.periodic.rtpreempt.priority", m_priority);
47 getProperty(prop,
"exec_cxt.periodic.cpu_affinity", m_cpu);
56 perror(
"wait_for_iob_signal()");
66 struct sched_param param;
70 if (sched_setscheduler(0, SCHED_FIFO, ¶m) == -1) {
71 perror(
"sched_setscheduler");
72 std::cerr <<
"If you are running this program on normal linux kernel for debug purpose, you can ignore the error message displayed above. If not, this program must have superuser privilege." << std::endl;
76 if(mlockall(MCL_CURRENT|MCL_FUTURE) == -1) {
77 perror(
"mlockall failed");
84 CPU_SET(
m_cpu, &cpu_set);
85 int result = sched_setaffinity(0,
sizeof(cpu_set_t), &cpu_set);
87 perror(
"sched_setaffinity():");
107 #ifndef OPENRTM_VERSION_TRUNK 109 RTC::ECCreate<RTC::hrpExecutionContext>,
110 RTC::ECDelete<RTC::hrpExecutionContext>);
112 RTC::ExecutionContextFactory::
113 instance().addFactory(
"hrpExecutionContext",
119 std::cerr <<
"hrpExecutionContext is registered" << std::endl;
AbstractClass * Creator()
void hrpECInit(RTC::Manager *manager)
static Manager & instance()
void stack_prefault(void)
unsigned long long read_iob_frame()
int wait_for_iob_signal()
wait until iob signal is issued
bool registerECFactory(const char *name, ECNewFunc new_func, ECDeleteFunc delete_func)
void Destructor(AbstractClass *&obj)