Skip to content

Commit f1095e0

Browse files
committed
fix issues in hrpExecutionContext
1 parent 86df87d commit f1095e0

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

ec/hrpEC/hrpEC-common.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace RTC
7777
#ifndef OPENRTM_VERSION_TRUNK
7878
invoke_worker iw;
7979
struct timeval tbegin, tend;
80-
std::vector<double> processes(m_comps.size());
80+
std::vector<double> processes(m_comps.size());
8181
gettimeofday(&tbegin, NULL);
8282
for (unsigned int i=0; i< m_comps.size(); i++){
8383
iw(m_comps[i]);
@@ -88,9 +88,23 @@ namespace RTC
8888
}
8989
#else
9090
struct timeval tbegin, tend;
91-
const RTCList& list = getComponentList();
91+
const RTCList& list2 = getComponentList();
92+
RTCList list;
93+
list.length(list2.length()+1);
94+
list[0] = getOwner();
95+
for (unsigned int i=0; i<list2.length(); i++){
96+
list[i+1] = list2[i];
97+
}
9298
std::vector<double> processes(list.length());
9399
gettimeofday(&tbegin, NULL);
100+
ExecutionContextBase::invokeWorkerPreDo();
101+
{
102+
std::unique_lock<std::mutex> guard(m_workerthread.mutex_);
103+
while (!m_workerthread.running_)
104+
{
105+
m_workerthread.cond_.wait(guard);
106+
}
107+
}
94108
for (unsigned int i=0; i< list.length(); i++){
95109
RTC_impl::RTObjectStateMachine* rtobj = m_worker.findComponent(list[i]);
96110
rtobj->workerDo();
@@ -99,6 +113,7 @@ namespace RTC
99113
processes[i] = dt;
100114
tbegin = tend;
101115
}
116+
ExecutionContextBase::invokeWorkerPostDo();
102117
#endif
103118
if (loop % debug_count == 0 && ENABLE_DEBUG_PRINT &&
104119
rtc_names.size() == processes.size()) {

0 commit comments

Comments
 (0)