diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-13 22:12:54 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-13 22:12:54 +0000 |
commit | 94c3f94b9b37ee9634376dd6b493d0b3f199da1b (patch) | |
tree | dc6abb2c41c9909645275c3a48d4252c30544407 /include | |
parent | 542ebb64a47df195c3887c711a7c4301a45de499 (diff) |
Add crash option
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1317 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-x | include/asterisk/lock.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 092672cae..9459042fc 100755 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -17,8 +17,10 @@ #include <pthread.h> #ifdef DEBUG_THREADS +#ifdef THREAD_CRASH +#define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while(0) +#endif -#define TRIES 50 #include <errno.h> #include <string.h> @@ -93,6 +95,9 @@ static inline int __ast_pthread_mutex_lock(char *filename, int lineno, char *fun } else { fprintf(stderr, "%s line %d (%s): Error obtaining mutex: %s\n", filename, lineno, func, strerror(errno)); +#ifdef THREAD_CRASH + DO_THREAD_CRASH; +#endif } return res; } @@ -121,9 +126,13 @@ static inline int __ast_pthread_mutex_unlock(char *filename, int lineno, char *f t->func = NULL; t->thread = 0; res = pthread_mutex_unlock(&t->mutex); - if (res) + if (res) { fprintf(stderr, "%s line %d (%s): Error releasing mutex: %s\n", filename, lineno, func, strerror(res)); +#ifdef THREAD_CRASH + DO_THREAD_CRASH; +#endif + } return res; } |