[openrtm-beginners:00331] Re: Deactivate RTC from onExecute

Geoffrey Biggs geoffrey.biggs @ aist.go.jp
2012年 1月 30日 (月) 23:02:40 JST


onExecute receives the handle to the execution context that is executing it. You can use this with the component's get_context() method to get the execution context itself. Then you can use the EC's deactivate_component() method to deactivate the component. However, to avoid a deadlock, you will need to do this from a separate thread.

In general, components are not meant to control their own life cycles, which is why it isn't so straight-forward to do. We usually prefer to signal an event somehow and have an external entity do the coordination.

Geoff

On Jan 30, 2012, at 8:59 PM, owh at ieee.org wrote:

> How can I deactivate RT-component from within the program? For example, from
> onExecute, or from other method. An illustrative case is that a user input
> toggled a bool variable, which is being checked in onExecute to decide if to
> deactivate (NOT exit) the component. Hope to get some help.
> 
> _______________________________________________
> openrtm-beginners mailing list
> openrtm-beginners at openrtm.org
> http://www.openrtm.org/mailman/listinfo/openrtm-beginners



openrtm-beginners メーリングリストの案内