Commit da79524ce13f1f9f4be362434df4fb70b4efc9af

Authored by Jürgen Knödlseder
1 parent 42c737c1

Add OpenPM critical zone for FITS file writing from within threads.

Showing 1 changed file with 6 additions and 2 deletions
src/ctobssim/ctobssim.cpp
... ... @@ -380,8 +380,12 @@ void ctobssim::run(void)
380 380 // Store output file name in original observation
381 381 obs->eventfile(outfile);
382 382  
383   - // Save observation into FITS file
384   - obs_clone.save(outfile, clobber());
  383 + // Save observation into FITS file. This is a critical zone
  384 + // to avoid multiple threads writing simultaneously
  385 + #pragma omp critical
  386 + {
  387 + obs_clone.save(outfile, clobber());
  388 + }
385 389  
386 390 }
387 391  
... ...