Last change
on this file since 1311 was
828,
checked in by mhnguyen, 8 years ago
|
Ticket 84: Replacing abort by MPI_Abort to prevent deadlocks in some environments
Test
+) On Curie.
+) All processe terminate if error happens. (In fact, on Curie, abort works well all the time)
|
-
Property copyright set to
Software name : XIOS (Xml I/O Server) http://forge.ipsl.jussieu.fr/ioserver Creation date : January 2009 Licence : CeCCIL version2 see license file in root directory : Licence_CeCILL_V2-en.txt or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement) CNRS/IPSL (Institut Pierre Simon Laplace) Project Manager : Yann Meurdesoif yann.meurdesoif@cea.fr
|
File size:
1.5 KB
|
Rev | Line | |
---|
[219] | 1 | #include "exception.hpp" |
---|
| 2 | |
---|
| 3 | /// boost headers /// |
---|
| 4 | #include <boost/cast.hpp> |
---|
[497] | 5 | #include "client.hpp" |
---|
| 6 | #include "server.hpp" |
---|
| 7 | #include "cxios.hpp" |
---|
[523] | 8 | #include "log.hpp" |
---|
[219] | 9 | |
---|
[335] | 10 | namespace xios |
---|
[219] | 11 | { |
---|
| 12 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 13 | CException::CException(void) |
---|
| 14 | : CObject(), desc_rethrow(true) |
---|
| 15 | { /* Ne rien faire de plus */ } |
---|
| 16 | |
---|
| 17 | CException::CException(const StdString & id) |
---|
| 18 | : CObject(id), desc_rethrow(true) |
---|
| 19 | { /* Ne rien faire de plus */ } |
---|
| 20 | |
---|
| 21 | CException::CException(const CException & exception) |
---|
| 22 | : std::basic_ios<char>() |
---|
| 23 | , CObject(exception.getId()) |
---|
| 24 | , StdOStringStream() |
---|
| 25 | , desc_rethrow(false) |
---|
| 26 | { (*this) << exception.str(); } |
---|
| 27 | |
---|
| 28 | CException::~CException(void) |
---|
[497] | 29 | { |
---|
[278] | 30 | if (desc_rethrow) |
---|
| 31 | #ifdef __XIOS_NOABORT |
---|
[497] | 32 | { |
---|
| 33 | throw (*this); |
---|
| 34 | } |
---|
[278] | 35 | #else |
---|
[497] | 36 | { |
---|
[523] | 37 | error << this->getMessage() << std::endl; |
---|
[828] | 38 | MPI_Abort(CXios::globalComm, -1); //abort(); |
---|
[497] | 39 | } |
---|
[278] | 40 | #endif |
---|
| 41 | } |
---|
[219] | 42 | |
---|
| 43 | //--------------------------------------------------------------- |
---|
| 44 | |
---|
| 45 | StdString CException::getMessage(void) const |
---|
| 46 | { |
---|
| 47 | StdOStringStream oss; |
---|
| 48 | oss << "> Error [" << this->getId() << "] : " << this->str(); |
---|
| 49 | return (oss.str()); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | StdOStringStream & CException::getStream(void) |
---|
| 53 | { return (*boost::polymorphic_cast<StdOStringStream*>(this)); } |
---|
| 54 | |
---|
| 55 | StdString CException::toString(void) const |
---|
| 56 | { return (StdString(this->getMessage())); } |
---|
| 57 | |
---|
| 58 | void CException::fromString(const StdString & str) |
---|
| 59 | { this->str(str); } |
---|
| 60 | |
---|
| 61 | //--------------------------------------------------------------- |
---|
| 62 | |
---|
[335] | 63 | } // namespace xios |
---|
Note: See
TracBrowser
for help on using the repository browser.