NDMeshStreamer: ignore invalid callbacks
authorLukasz Wesolowski <wesolwsk@illinois.edu>
Wed, 29 Aug 2012 02:54:03 +0000 (21:54 -0500)
committerLukasz Wesolowski <wesolwsk@illinois.edu>
Wed, 29 Aug 2012 02:58:14 +0000 (21:58 -0500)
src/libs/ck-libs/NDMeshStreamer/NDMeshStreamer.h

index 37ca015bcc21814ce8fe094d8e01b60f19d332e5..7fd963a9d9c393e61105d780e3fa2ddd88b9d35b 100644 (file)
@@ -58,7 +58,9 @@ class MeshStreamerArrayClient : public CBase_MeshStreamerArrayClient<dtype>{
 private:
   CompletionDetector *detectorLocalObj_;
 public:
-  MeshStreamerArrayClient(){}
+  MeshStreamerArrayClient(){
+    detectorLocalObj_ = NULL; 
+  }
   MeshStreamerArrayClient(CkMigrateMessage *msg) {}
   // would like to make it pure virtual but charm will try to
   // instantiate the abstract class, leading to errors
@@ -73,7 +75,9 @@ public:
 #ifdef STREAMER_VERBOSE_OUTPUT
     CkPrintf("[%d] redelivered to index %d\n", CkMyPe(), this->thisIndex.data[0]);
 #endif
-    detectorLocalObj_->consume();
+    if (detectorLocalObj_ != NULL) {
+      detectorLocalObj_->consume();
+    }
     process(data);
   }
 
@@ -248,7 +252,10 @@ public:
         CkPrintf("[%d] contribute\n", CkMyPe()); 
 #endif
         CkAssert(numDataItemsBuffered_ == 0); 
-        this->contribute(userCallback_);
+        if (!userCallback_.isInvalid()) {
+          this->contribute(userCallback_);
+          userCallback_ = CkCallback();
+        }
         return; 
       }
       else if (individualDimensionSizes_[dimensionToFlush_] != 1) {