Commit 60aa959e99bc33ca3d176a0eccf5fa089b1fd94c
1 parent
830ce1be
Test catching of exception within critical OpenMP block
Showing
1 changed file
with
14 additions
and
5 deletions
src/support/ctool.cpp
| ... | ... | @@ -594,7 +594,8 @@ GEbounds ctool::create_ebounds(void) |
| 594 | 594 | |
| 595 | 595 | // Make loading of energy boundaries OpenMP thread save |
| 596 | 596 | #pragma omp critical(ctool_create_ebounds1) |
| 597 | - { | |
| 597 | + //{ | |
| 598 | + try { | |
| 598 | 599 | |
| 599 | 600 | // Open energy boundary file using the EBOUNDS or ENERGYBINS |
| 600 | 601 | // extension or energy values using the ENERGIES extension. |
| ... | ... | @@ -624,8 +625,11 @@ GEbounds ctool::create_ebounds(void) |
| 624 | 625 | "file \""+ebinfile+"\". Please specify a " |
| 625 | 626 | "valid energy binning file."; |
| 626 | 627 | } |
| 627 | - | |
| 628 | - } // end: omp critical section | |
| 628 | + } | |
| 629 | + catch (const std::exception& e) { | |
| 630 | + msg = e.what(); | |
| 631 | + } | |
| 632 | + //} // end: omp critical section | |
| 629 | 633 | |
| 630 | 634 | } // endif: no extension name specified |
| 631 | 635 | |
| ... | ... | @@ -635,7 +639,8 @@ GEbounds ctool::create_ebounds(void) |
| 635 | 639 | |
| 636 | 640 | // Make loading of energy boundaries OpenMP thread save |
| 637 | 641 | #pragma omp critical(ctool_create_ebounds2) |
| 638 | - { | |
| 642 | + //{ | |
| 643 | + try { | |
| 639 | 644 | |
| 640 | 645 | // Open energy boundary file |
| 641 | 646 | GFits file(ebinfile.url()); |
| ... | ... | @@ -669,7 +674,11 @@ GEbounds ctool::create_ebounds(void) |
| 669 | 674 | |
| 670 | 675 | } // endelse: extension name was present in FITS file |
| 671 | 676 | |
| 672 | - } // end: omp critical section | |
| 677 | + } | |
| 678 | + catch (const std::exception& e) { | |
| 679 | + msg = e.what(); | |
| 680 | + } | |
| 681 | + //} // end: omp critical section | |
| 673 | 682 | |
| 674 | 683 | } // endelse: loaded energy boundaries from table extension |
| 675 | 684 | ... | ... |