- if ( !CORBA::is_nil( Component() ) ) {
- try {
- RetVal = Component()->Kill_impl() ;
- }
- catch( ... ) {
- cdebug << "InNode::Suspend() catched" << endl ;
- State( GraphExecutor::ErroredState ) ;
- _OutNode->State( GraphExecutor::ErroredState ) ;
- RetVal = false ;
- }
- cdebug << "Component()->Kill_impl() returns status " << RetVal << endl ;
- RetVal = true ;
- if ( IsRunning() ) {
- cdebug << pthread_self() << "GraphExecutor::InNode::Kill_impl " << Name()
- << " --> thread" << ThreadNo() << " SuspendEvent " << endl;
- SendEvent( GraphExecutor::KillEvent ) ;
- cdebug << pthread_self() << "GraphExecutor::InNode::Killed_impl in Container"
- << Name() << " --> thread" << ThreadNo() << endl;
- }
- else if ( IsDone() ) {
- ControlState( SUPERV::VoidState ) ;
- RetVal = false ; // Too late ...
+// We have to suspend in the container of that node
+ int TryKill = 10 ;
+ while ( TryKill ) {
+ if ( !CORBA::is_nil( Component() ) ) {
+// We can call that component
+ try {
+ RetVal = Component()->Kill_impl() ;
+ }
+ catch( ... ) {
+ cdebug << "InNode::Kill_impl ERROR catched" << endl ;
+ State( GraphExecutor::ErroredState ) ;
+ _OutNode->State( GraphExecutor::ErroredState ) ;
+ RetVal = false ;
+ TryKill = 1 ;
+ }
+ cdebug << "Component()->Kill_impl() returns status " << RetVal << endl ;
+ if ( RetVal ) {
+ if ( IsRunning() ) {
+ cdebug << pthread_self() << "GraphExecutor::InNode::Kill_impl " << Name()
+ << " --> thread" << ThreadNo() << " KillEvent " << endl;
+ SendEvent( GraphExecutor::KillEvent ) ;
+ cdebug << pthread_self() << "GraphExecutor::InNode::Killed_impl in Container"
+ << Name() << " --> thread" << ThreadNo() << endl;
+ TryKill = 1 ;
+ }
+ else if ( IsDone() ) {
+ ControlState( SUPERV::VoidState ) ;
+ RetVal = false ; // Too late ...
+ TryKill = 1 ;
+ }
+ else {
+ cdebug << "Kill component Killed and !IsDone and !IsRunning !"
+ << endl ;
+ TryKill = 1 ;
+ }
+ }
+ else {
+// Kill in the Container failed : it is always false if it is a Python Container
+ cdebug << "InNode::Suspend cannot Kill component ! Python Component ?"
+ << endl ;
+ if ( TryKill == 1 ) {
+ if ( IsKilled() ) {
+ RetVal = true ;
+ }
+ else {
+ RetVal = false ;
+ }
+ }
+ }