orocos-toolchain/rtt — pull request #70 by psoetens (2014-10-22 08:22:41+00:00)
Title: updateHook() called too often

As discussed in length in this forum thread: http://www.orocos.org/forum/rtt/rtt-dev/changing-behaviour-updatehook :

We have observed lately two major issues:

> 1. updateHook() is called *too many times* (even according to
> specifications), especially when 'OwnThread' operations are implemented OR
> called(!).
> -> This was due to internal bookkeeping of the ExecutionEngine to dispatch
> the asynchronous requests. Users found it confusing that updateHook was
> called during the use of operations. This also kills performance of Lua
> state machines
> sitting in updateHook(), since they are evaluated too many times.
>
> 2. Installing a callback for an event port caused calling that callback AND
> updateHook(), instead of calling only the callback.
> -> The callback does not replace the call to updateHook(). This is also
> related to users being surprised that an event port callback is only called
> periodically in periodic threads, while they thought it would be called
> immediately upon each event reception, and eventually updateHook
> periodically (but serialized with the callbacks).
>
> The idea then rose to have updateHook() to only be called after:
> 1) any call to TaskContext::trigger()
> -> for activities which allow this user control
> 2) the component's activity triggered itself (periodic, file descriptor,
> ...)
> -> what users expect
> 3) the component is being update()
> -> for slave activity behavior

I'm creating a simple patch that addresses both issues, in a backwards compatible way.