From d1b55ca3e719d211957e1b456e26e13018150972 Mon Sep 17 00:00:00 2001 From: paulc Date: Tue, 1 Jul 2008 14:57:43 +0000 Subject: [PATCH] Abort immediately on highly critical errors even if not requested from command line. git-svn-id: http://yate.null.ro/svn/yate/trunk@2043 acf43c95-373e-0410-b603-e72c3f656dc1 --- engine/Mutex.cpp | 5 ++++- engine/Thread.cpp | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/Mutex.cpp b/engine/Mutex.cpp index b626546f..d6bd45bd 100644 --- a/engine/Mutex.cpp +++ b/engine/Mutex.cpp @@ -271,8 +271,11 @@ void MutexPrivate::unlock() tname,m_owner,this); m_owner = 0; } - if (--s_locks < 0) + if (--s_locks < 0) { + // this is very very bad - abort right now + abortOnBug(true); Debug(DebugFail,"MutexPrivate::locks() is %d [%p]",s_locks,this); + } #ifdef _WINDOWS ::ReleaseMutex(m_mutex); #else diff --git a/engine/Thread.cpp b/engine/Thread.cpp index 997ef006..9e099be3 100644 --- a/engine/Thread.cpp +++ b/engine/Thread.cpp @@ -97,8 +97,10 @@ class ThreadPrivateKeyAlloc public: ThreadPrivateKeyAlloc() { - if (::pthread_key_create(¤t_key,ThreadPrivate::destroyFunc)) + if (::pthread_key_create(¤t_key,ThreadPrivate::destroyFunc)) { + abortOnBug(true); Debug(DebugFail,"Failed to create current thread key!"); + } } };