]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Fix for bug IPAL14711 : Porting problem: "omniORB.CORBA.COMM_FAILURE" is raised after...
authormkr <mkr@opencascade.com>
Fri, 9 Feb 2007 13:55:38 +0000 (13:55 +0000)
committermkr <mkr@opencascade.com>
Fri, 9 Feb 2007 13:55:38 +0000 (13:55 +0000)
src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.cxx
src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx
src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx
src/GraphExecutor/DataFlowExecutor_OutNode.cxx
src/GraphExecutor/DataFlowExecutor_OutNode.hxx

index 8408f5c2ff6ad6dea988911311b4fd55a47695f9..36b70bfe190eeb64842f6426424f17fb56cc7840 100644 (file)
@@ -728,6 +728,13 @@ void GraphExecutor::FiniteStateMachine::JoinThread( pthread_t aThread ) {
   }
 }
 
+int GraphExecutor::FiniteStateMachine::ThreadsNumber() {
+  if( _ThreadList.begin() == _ThreadList.end() )
+    return 0;
+  else
+    return _ThreadList.size();
+}
+
 ostream & operator<< (ostream &f ,const GraphExecutor::AutomatonState & aState ) {
   switch (aState) {
   case GraphExecutor::UnKnownState :
index 40f2c06f427a4a9f090771ebf2b792d924a5e400..257c208dbd5631bc048830373356558ae414748f 100644 (file)
@@ -233,6 +233,8 @@ namespace GraphExecutor {
       void JoinThread() ;
       void JoinThread( pthread_t aThread ) ;
 
+      int ThreadsNumber() ; // mkr : IPAL14711
+
       const char * ControlStateName( const SUPERV::ControlState & aState ) const {
             return _ControlStateName[ aState ] ; } ;
       const char * StateName( const GraphExecutor::AutomatonState & aState ) const {
index 500888155805b2dfd8039250cb89a7ac0ee41096..1f48695c98ba9c3370f077056b49599c00697078 100644 (file)
@@ -637,6 +637,7 @@ int GraphExecutor::InNode::executeAction() {
         delete [] msg ;
         pthread_exit( msg ) ;
       }
+      _OutNode->setRunFuncThread( T ) ; // mkr : IPAL14711
 #if ActionsTrace
       cdebug << pthread_self() << "/" << ThreadNo() << " " << Name()
              << " executeAction has created thread " << T << endl ;
index 20359ef9aad7634385eea0496b2b4e53d64031b7..44eb52782f310fb3620eedd07ce783f2cc922594 100644 (file)
@@ -55,6 +55,7 @@ GraphExecutor::OutNode::OutNode() {
   _ControlState = SUPERV::VoidState ;
   _State = GraphExecutor::UnKnownState ;
   _PyInitialized = false ;
+  _run_func_thread = 0;
   pthread_mutex_init( &_MutexWait , NULL ) ;
   pthread_mutex_init( &_PyMutexWait , NULL ) ;
   if ( pthread_cond_init( &_EventWait , NULL ) ) {
@@ -96,6 +97,7 @@ GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB,
   _ControlState = SUPERV::VoidState ;
   _State = GraphExecutor::UnKnownState ;
   _PyInitialized = false ;
+  _run_func_thread = 0;
   _Orb = CORBA::ORB::_duplicate( ORB ) ;
   pthread_mutex_init( &_MutexWait , NULL ) ;
   pthread_mutex_init( &_PyMutexWait , NULL ) ;
@@ -159,6 +161,7 @@ GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB,
   _ControlState = SUPERV::VoidState ;
   _State = GraphExecutor::UnKnownState ;
   _PyInitialized = false ;
+  _run_func_thread = 0;
   _Orb = CORBA::ORB::_duplicate( ORB ) ;
   pthread_mutex_init( &_MutexWait , NULL ) ;
   pthread_mutex_init( &_PyMutexWait , NULL ) ;
@@ -836,7 +839,7 @@ void GraphExecutor::OutNode::CheckAllDone() {
     MESSAGE("================================================================================") ;
     cdebug << "================================================================================" << endl ;
     cdebug << Name() << " IS DONE : " <<  theAutomaton->StateName( AutomatonState() ) << " EventQSize "
-             << EventQSize() << endl  ;
+            << EventQSize() << endl  ;
     cdebug << "================================================================================" << endl ;
 
 //PAL8520
@@ -957,6 +960,7 @@ void GraphExecutor::OutNode::ExitThread( pthread_t ThreadNumber ) {
     cdebug << pthread_self() << " ExitThread( " << ThreadNumber << " ) " << _Threads
            << " running threads " << _SuspendedThreads << " suspended threads IsDone() "
            << IsDone() ;
+    _run_func_thread = 0 ; // mkr : IPAL14711
     if ( IsDone() ) {
       cdebug << " ==> theAutomaton->Executed() " << endl ;
       theAutomaton->Executed() ;
@@ -2144,6 +2148,10 @@ bool GraphExecutor::OutNode::DoneWait() {
     perror("pthread_mutex_lock _DoneWait") ;
     exit( 0 ) ;
   }
+  while ( _run_func_thread || theAutomaton->ThreadsNumber() ) {
+    // mkr : IPAL14711
+    // waiting for pthread_join in FiniteStateMachine
+  }
   if ( Done() || IsKilled() ) Graph()->GraphEditor()->Editing(); // mkr : IPAL14572 : calling Editing() to indicate stop of execution
   cdebug_out << pthread_self() << " GraphExecutor::DoneWait " << this << " " << Name()
              << " " << State() << " : " << aret << endl ;
index 200d42b60120a3291512b1aa6150601e35eea23c..4a2a7da88744fcbf2bf39af1d147b503aa7f84e5 100644 (file)
@@ -70,6 +70,8 @@ namespace GraphExecutor {
       list< GraphExecutor::NodeEvent > _Events ;
       list< GraphExecutor::AutomatonState >   _States ;
 
+      pthread_t _run_func_thread ;
+
       bool Valid() ;
       void UnValid() ;
       bool Executable() ;
@@ -269,6 +271,8 @@ namespace GraphExecutor {
                                    const char *FromParameterName ) ;
       const long CpuUsed() ;
       const long CpuUsed( const char *aNodeName ) ;
+
+      void setRunFuncThread( pthread_t theThread ) { _run_func_thread = theThread; } ; // mkr : IPAL14711
   };
 };