source: XIOS/dev/XIOS_DEV_CMIP6/src/exception.cpp @ 1291

Last change on this file since 1291 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
Line 
1#include "exception.hpp"
2
3/// boost headers ///
4#include <boost/cast.hpp>
5#include "client.hpp"
6#include "server.hpp"
7#include "cxios.hpp"
8#include "log.hpp"
9
10namespace xios
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)
29   {
30      if (desc_rethrow)
31#ifdef __XIOS_NOABORT
32      {
33        throw (*this);
34      }
35#else
36     {
37      error << this->getMessage() << std::endl;
38      MPI_Abort(CXios::globalComm, -1); //abort();
39      }
40#endif
41   }
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
63} // namespace xios
Note: See TracBrowser for help on using the repository browser.