00001 00002 /* Copyright (c) 2007, Stefan Eilemann <eile@equalizergraphics.com> 00003 * 00004 * This library is free software; you can redistribute it and/or modify it under 00005 * the terms of the GNU Lesser General Public License version 2.1 as published 00006 * by the Free Software Foundation. 00007 * 00008 * This library is distributed in the hope that it will be useful, but WITHOUT 00009 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00010 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00011 * details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this library; if not, write to the Free Software Foundation, Inc., 00015 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00016 */ 00017 00018 #include "debug.h" 00019 00020 #include "atomic.h" 00021 00022 #ifndef NDEBUG 00023 namespace eq 00024 { 00025 namespace base 00026 { 00027 00028 EQ_EXPORT void abort() 00029 { 00030 // if EQ_ABORT_WAIT is set, spin forever to allow identifying and debugging 00031 // crashed nodes. 00032 if( getenv( "EQ_ABORT_WAIT" )) 00033 while( true ) ; 00034 00035 ::abort(); 00036 } 00037 00038 EQ_EXPORT void checkHeap() 00039 { 00040 #ifdef WIN32 00041 static mtLong count( 0 ); 00042 if( ( ++count % 1000 ) == 0 && _heapchk() != _HEAPOK ) 00043 { 00044 EQERROR << disableFlush << "Abort: heap corruption detected" << std::endl 00045 << " Set breakpoint in " << __FILE__ << ':' << __LINE__ + 1 00046 << " to debug" << std::endl << enableFlush; 00047 } 00048 #else 00049 #endif 00050 } 00051 00052 } 00053 } 00054 #endif
0.9 by
1.5.8