Changeset 261


Ignore:
Timestamp:
Dec 2, 2002, 3:57:56 PM (18 years ago)
Author:
pooh
Message:
  • Added terminate handler.
  • Workaround to force a creation of global init object.
Location:
to-imperative/trunk/libp++
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/libp++/pxx_common.cc

    r254 r261  
    2222
    2323#include "pxx_common.ih"
     24#include "pxx_sys_error.ih"
    2425
    2526#include <stdarg.h>
    2627#include <unistd.h>
     28#include <typeinfo>
     29#include <cxxabi.h>
    2730
    2831namespace pxx
     
    3235
    3336void (*terminate) (int _error_code) = null ;
     37
     38void terminate_handler ()
     39{
     40  try {
     41    throw;
     42  } catch (SysError e) {
     43    e.print();
     44    exit(e.get_code());
     45  } catch (...) {
     46    FATAL("Unknown exception thrown");
     47  }
     48}
    3449
    3550void fatal (char* _fmt, ...)
     
    6782  {
    6883    unsigned i;
     84    std::set_terminate(terminate_handler);
    6985    page_size = getpagesize();
    7086    orders[0] = 0;
     
    86102
    87103Init init ;
     104Init* __pinit = &init;
    88105
    89106}
  • to-imperative/trunk/libp++/pxx_common.hh

    r254 r261  
    136136#define pxx_min(a,b) ((a) < (b) ? (a) : (b))
    137137
     138class Init;
     139extern Init* __pinit;
     140static Init* __static_pinit = __pinit;
     141
    138142}
    139143
Note: See TracChangeset for help on using the changeset viewer.