Refactor ExecutionEngine operation processing for slave components #289
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The patch reverts most of the previous patches applied to the
ExecutionEngine
to fix the issue thatOwnThread
operations provided by components running in a SlaveActivity have only been executed when the slave was updated, but never asynchronously like for normal activities. This caused dead-locks in certain situations when calling operations of slaves that are never updated before the call returns. The history of the reverted patches started with #35, with follow-ups in #59, #60 and #71.The
slave_test
added in https://github.com/orocos-toolchain/rtt/pull/71/files#diff-926cb9fdc506c3abaed334876a3402a5 was not reverted and still succeeds with the new patch.The new solution to the original problem is much less intrusive: Instead of forwarding the operations calls itself and making the ExecutionEngine aware of the existence of masters and slaves, the SlaveActivity that gets triggered (e.g. as a consequence of an operation call) enqueues a message in the master's ExecutionEngine that processes the triggers in the slave's ExecutionEngine
work(Trigger)
callback, which then processes all the pending messages (and port callbacks) of the slave. This also works across multiple levels of master/slave relations. The difference to the previous solutions is that the pending messages are still enqueued in the engine of the actual runner and explicit calls toSlave.update()
from the master thread will also process the pending operations of the slave - but not of the master itself.The
work(Trigger)
callback was only introduced in #91 and not yet available back in 2014. Without, it would not be possible to selectively process asynchronous messages of the slave without also triggering synchronous processing steps likeupdateHook()
. In general, since #91 operations and event port callbacks are executed asynchronously, as part of the callback step, while before they were only executed through a full (periodic or non-periodic) update step.@goldhoorn As the original reporter and author of the first proposed solution in #35, and in case you are still using RTT, could you please test this alternative approach for your application(s)?