Moved proxy patch creation from Patch::Patch() to Patch::init() to avoid a race condi...
authorDavid Kunzman <kunzman2@illinois.edu>
Wed, 18 Mar 2009 19:02:47 +0000 (19:02 +0000)
committerDavid Kunzman <kunzman2@illinois.edu>
Wed, 18 Mar 2009 19:02:47 +0000 (19:02 +0000)
examples/charm++/cell/md/patch.C

index 32387973b57998d6d854f5889cc78618a5a00f14..8c420ae0f89bbafadff704b325a9a2cb974dee2f 100644 (file)
@@ -32,11 +32,6 @@ Patch::Patch() {
   forceSumX = forceSumY = forceSumZ = NULL;
   velocityX = velocityY = velocityZ = NULL;
   numParticles = -1;
-
-  #if USE_PROXY_PATCHES != 0
-    const int patchIndex = PATCH_XYZ_TO_I(thisIndex.x, thisIndex.y, thisIndex.z);
-    proxyPatchProxy = CProxy_ProxyPatch::ckNew(patchIndex);
-  #endif
 }
 
 
@@ -65,7 +60,11 @@ void Patch::init(int numParticles) {
 
   // Also tell the proxy patches to initialize
   #if USE_PROXY_PATCHES != 0
+  {
+    const int patchIndex = PATCH_XYZ_TO_I(thisIndex.x, thisIndex.y, thisIndex.z);
+    proxyPatchProxy = CProxy_ProxyPatch::ckNew(patchIndex);
     proxyPatchProxy.init(numParticles);
+  }
   #endif
 
   // Allocate memory for the particles