Hi,
I am writing a component that treats some heavy computations in his own thread when some commands are invoked from an other component. Each computation is divided into small computation chunks so that my component can treat other commands between these computation chunks. My updateHook function looks like something like that:
1. void MyTaskContext::updateHook() 2. { 3. more_computation(); 4. this->engine()->step(); 5. }
In somes cases, line 4 makes my component unexpectedly and very strangely crash. Valgrind reports some "bad permissions access" to the basic_string() constructor from calls to the my_component_state_machine->inState("SomeState")...
But if replace line 4 by the following line: new4. this->doTrigger(); then my component seems to work like a charm. What is the difference between "this->engine()->step()" and "this->doTrigger()"? Does "this->doUpdate()" work in a similar way?
Best, Florent Teichteil
TaskContext::doTrigger() vs. ExecutionEngine::step()
On Mon, Nov 2, 2009 at 15:02, <florent [dot] teichteil [..] ...> wrote:
> Hi,
>
> I am writing a component that treats some heavy computations in his own thread when some commands are invoked from an other component.
> Each computation is divided into small computation chunks so that my component can treat other commands between these computation chunks. My updateHook function looks like something like that:
>
> 1. void MyTaskContext::updateHook()
> 2. {
> 3. more_computation();
> 4. this->engine()->step();
> 5. }
>
> In somes cases, line 4 makes my component unexpectedly and very strangely crash. Valgrind reports some "bad permissions access" to the basic_string() constructor from calls to the my_component_state_machine->inState("SomeState")...
You are *not* allowed to step() your own execution engine. Ever. This
basically recurses infinitely. The crash is probably your stack being
exhausted.
>
> But if replace line 4 by the following line:
> new4. this->doTrigger();
> then my component seems to work like a charm.
> What is the difference between "this->engine()->step()" and "this->doTrigger()"? Does "this->doUpdate()" work in a similar way?
I'm assuming you have a non-periodic activity here. In that case, you
must call doTrigger(). You're not allowed to use doUpdate() which
might also recurse infinitely (it will return false in non periodic
mode anyway).
The idea is this: *only* your actvities execute your engine. You must
call the start/trigger/stop API of the ActivityInterface to control
the stepping. doTrigger is a shorthand for:
Peter
TaskContext::doTrigger() vs. ExecutionEngine::step()
Hi,
I am writing a component that treats some heavy computations in his own thread when some commands are invoked from an other component.
Each computation is divided into small computation chunks so that my component can treat other commands between these computation chunks. My updateHook function looks like something like that:
1. void MyTaskContext::updateHook()
2. {
3. more_computation();
4. this->engine()->step();
5. }
In somes cases, line 4 makes my component unexpectedly and very strangely crash. Valgrind reports some "bad permissions access" to the basic_string() constructor from calls to the my_component_state_machine->inState("SomeState")...
But if replace line 4 by the following line:
new4. this->doTrigger();
then my component seems to work like a charm.
What is the difference between "this->engine()->step()" and "this->doTrigger()"? Does "this->doUpdate()" work in a similar way?
Best,
Florent Teichteil