Commit 62cd0416 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Ensure that threads without input data get no output pointers

parent 82f2efda
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -434,6 +434,11 @@ void cluster(const string& config_file, const string& data_file, const string& o
	      p_outarray[myompthread] = p_output_2;
	    }
	    int jer = cluster_jxi488_cycle(myjxi488, sconf, gconf, p_scattering_angles, cid_2, p_output_2, output_path, vtppoanp_2);
	  } else {
	    if (myompthread > 0) {
	      // If there is no input for this thread, set output pointer to NULL.
	      p_outarray[myompthread] = NULL;
	    }
	  }
#pragma omp barrier

@@ -616,7 +621,12 @@ void cluster(const string& config_file, const string& data_file, const string& o
	    p_outarray[0] = p_output_2;
	  }
	  int jer = cluster_jxi488_cycle(myjxi488, sconf, gconf, p_scattering_angles, cid_2, p_output_2, output_path, vtppoanp_2);
	} // close the OMP parallel for loop
	} else {
	  if (myompthread > 0) {
	    // If there is no input for this thread, set the output pointer to NULL.
	    p_outarray[myompthread] = NULL;
	  }	  
	}

#pragma omp barrier
	// threads different from 0 append their virtual files to the one of thread 0, and delete them