Add ast_assert(), which can be used to handle fatal errors. It is only compiled

in if dev-mode is enabled, and only aborts if DO_CRASH is defined.
(inspired by issue #12650)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@116463 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2008-05-14 21:32:00 +00:00
parent 32945354d3
commit 4b2a679f9e
8 changed files with 36 additions and 21 deletions

View File

@@ -1340,17 +1340,10 @@ static inline int ast_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds,
#endif
}
#ifdef DO_CRASH
#define CRASH do { fprintf(stderr, "!! Forcing immediate crash a-la abort !!\n"); *((int *)0) = 0; } while(0)
#else
#define CRASH do { } while(0)
#endif
#define CHECK_BLOCKING(c) do { \
if (ast_test_flag(c, AST_FLAG_BLOCKING)) {\
if (option_debug) \
ast_log(LOG_DEBUG, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), (c)->name, (long) (c)->blocker, (c)->blockproc); \
CRASH; \
} else { \
(c)->blocker = pthread_self(); \
(c)->blockproc = __PRETTY_FUNCTION__; \