Slave activity with 2 masters

Hello,

I am using Orocos RTT 1.6 under linux.

I have one component Slave with a slave activity.

I have 2 components Master1 and Master2 with non periodic acivities.
(The 2 Masters are not configured as master for the slave in the deployer).
The 2 masters are calling (in C++) "Slave->engine()->getActivity()->execute()" (when they receive an event).

Is it a problem that my Slave component is executed in 2 different activities (ie. thread) ?

My observation :
- if the second execute() (Master2.event()) is called after the end of the first execute() (Master1.event()) it works.
- if the second execute() is called before the end of the first execute(), it is not executed.

Is it the expected behaviour ?
Is there a documentation about it ?

Thank you,
Renaud

Slave activity with 2 masters

On Tue, Jul 28, 2009 at 10:31, <renaud [dot] heitz [..] ...> wrote:
> Hello,
>
> I am using Orocos RTT 1.6 under linux.
>
> I have one component Slave with a slave activity.
>
> I have 2 components Master1 and Master2 with non periodic acivities.
> (The 2 Masters are not configured as master for the slave in the deployer).
> The 2 masters are calling (in C++) "Slave->engine()->getActivity()->execute()" (when they receive an event).
>
> Is it a problem that my Slave component is executed in 2 different activities (ie. thread) ?

Yes because your updateHook() is no longer thread-safe. Your slave
should have only one master (thread).

>
> My observation :
> - if the second execute() (Master2.event()) is called after the end of the first execute() (Master1.event()) it works.
> - if the second execute() is called before the end of the first execute(), it is not executed.

This is possible. The only solution I see for your case is to embed a
Mutex into SlaveActivity::execute() such that all access is
serialised. This will block your second execute until the first
completed though. This looks like a good compromise in my opinion ?

>
> Is it the expected behaviour ?

It is 'undefined behaviour'.

> Is there a documentation about it ?

SlaveActivity assumed one master, so multiple master slaves are not documented.

Peter