Who is executing the Callback on an NewDataOnPortEvent

I was wondering about something.

I have the following code:

event_ = port->getNewDataOnPortEvent();
event_handler_ =
event_->connect(boost::bind(&TemplateRosWritePort<T>::publishCallback,this,_1));

This 'event' and the 'this'-object live in component1 with a ReadPort
'port' connected to a WritePort on component2

When component2 does a write on its WritePort, in which thread does
the 'publishCallback' get executed?

Ruben

Who is executing the Callback on an NewDataOnPortEvent

On Thu, May 28, 2009 at 22:39, Ruben Smits <ruben [dot] smits [..] ...> wrote:
> I was wondering about something.
>
> I have the following code:
>
>  event_ = port->getNewDataOnPortEvent();
>  event_handler_ =
> event_->connect(boost::bind(&TemplateRosWritePort<T>::publishCallback,this,_1));
>
> This 'event' and the 'this'-object live in component1 with a ReadPort
> 'port' connected to a WritePort on component2
>
> When component2 does a write on its WritePort, in which thread does
> the 'publishCallback' get executed?

The one that emits the event, ie writes to the port. You need to setup
an asynchronous
event handler if you want to defer the callback handling to another thread.

Peter