]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkAtomicBlackBox.cxx
Another ugly bug fixed in pipeline executing (bad transfer to parent in some cases...
[bbtk.git] / kernel / src / bbtkAtomicBlackBox.cxx
index a947d006315da4263a2f615af8fa5691327f93c8..1b11dcf7b355dd804d5e10dc9b26683aee2226f5 100644 (file)
@@ -2,8 +2,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkAtomicBlackBox.cxx,v $
   Language:  C++
-  Date:      $Date: 2008/10/17 08:18:12 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2008/11/13 14:46:43 $
+  Version:   $Revision: 1.9 $
 =========================================================================*/
 
 /* ---------------------------------------------------------------------
@@ -92,7 +92,18 @@ namespace bbtk
                        "=> AtomicBlackBox::bbBackwardUpdate("
                        <<(caller?caller->GetFullName():"0")<<") ["
                        <<bbGetFullName()<<"]"<<std::endl);
-    
+
+    // If already executing : return
+    if (bbGetExecuting()) 
+      {
+       bbtkDebugMessage("process",3,
+                        " -> already executing : bailing out"<<std::endl);
+       return bbGetStatus();
+      }
+    bbSetExecuting(true);
+    bool wasExecuting = bbGlobalGetSomeBoxExecuting();
+    bbGlobalSetSomeBoxExecuting(true);
+
     bbtkDebugMessage("process",5,"Initial Status  = "<<bbGetStatus()
                     <<std::endl);
     bbtkDebugMessage("process",5,"BoxProcessMode  = "
@@ -103,15 +114,14 @@ namespace bbtk
         ( bbBoxProcessModeIsAlways() ) )
       {
 
-       bbSetStatus(UPDATING);
-       
-       bool wasExecuting = bbGlobalGetSomeBoxExecuting();
-        bbGlobalSetSomeBoxExecuting(true);
+       //      bbSetStatus(UPDATING);
 
         // Updates its inputs
         IOStatus s = bbUpdateInputs();
     
-        bbtkDebugMessage("process",6,"Inputs post-update status = "<<s<<std::endl);
+        bbtkDebugMessage("process",6,"=> AtomicBlackBox::bbBackwardUpdate("
+                       <<(caller?caller->GetFullName():"0")<<") ["
+                       <<bbGetFullName()<<"] : Inputs post-update status = "<<s<<std::endl);
         // If all inputs are in UPTODATE post-update status 
         // and mProcessMode is not "Always"
         // then the box is now UPTODATE
@@ -134,7 +144,6 @@ namespace bbtk
         // Displays the window (WxBlackbox)
         bbShowWindow(caller);
 
-        bbGlobalSetSomeBoxExecuting(wasExecuting);
 
       }
     else 
@@ -142,12 +151,16 @@ namespace bbtk
         bbtkDebugMessage("process",5,"Up-to-date : nothing to do"<<std::endl);
       }
 
-    bbtkDebugMessage("process",5,"Final Status    = "
-            <<bbGetStatus()<<std::endl);
+    bbtkDebugMessage("process",5,"=> AtomicBlackBox::bbBackwardUpdate("
+                    <<(caller?caller->GetFullName():"0")<<") ["
+                    <<bbGetFullName()<<"] : Final Status    = "
+                    <<bbGetStatus()<<std::endl);
     bbtkDebugMessage("process",3,
             "<= AtomicBlackBox::bbBackwardUpdate() ["
             <<bbGetFullName()<<"]"<<std::endl);
 
+    bbSetExecuting(false);
+    bbGlobalSetSomeBoxExecuting(wasExecuting);
 
     return bbGetStatus();