From 60aa959e99bc33ca3d176a0eccf5fa089b1fd94c Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Wed, 26 Jun 2019 22:26:37 +0200 Subject: [PATCH] Test catching of exception within critical OpenMP block --- src/support/ctool.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/support/ctool.cpp b/src/support/ctool.cpp index 4444c8e..e3f384a 100755 --- a/src/support/ctool.cpp +++ b/src/support/ctool.cpp @@ -594,7 +594,8 @@ GEbounds ctool::create_ebounds(void) // Make loading of energy boundaries OpenMP thread save #pragma omp critical(ctool_create_ebounds1) - { + //{ + try { // Open energy boundary file using the EBOUNDS or ENERGYBINS // extension or energy values using the ENERGIES extension. @@ -624,8 +625,11 @@ GEbounds ctool::create_ebounds(void) "file \""+ebinfile+"\". Please specify a " "valid energy binning file."; } - - } // end: omp critical section + } + catch (const std::exception& e) { + msg = e.what(); + } + //} // end: omp critical section } // endif: no extension name specified @@ -635,7 +639,8 @@ GEbounds ctool::create_ebounds(void) // Make loading of energy boundaries OpenMP thread save #pragma omp critical(ctool_create_ebounds2) - { + //{ + try { // Open energy boundary file GFits file(ebinfile.url()); @@ -669,7 +674,11 @@ GEbounds ctool::create_ebounds(void) } // endelse: extension name was present in FITS file - } // end: omp critical section + } + catch (const std::exception& e) { + msg = e.what(); + } + //} // end: omp critical section } // endelse: loaded energy boundaries from table extension -- libgit2 0.21.4