aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-08 18:48:01 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-08 18:48:01 +0000
commit68b2d23c850a75b9438badf60b616e9a8537066e (patch)
tree8ff25581aa24db4702979aa7b71100c03d1a0373 /include
parent87b6171076654391a9c925fccd750de21073a950 (diff)
Minor deadlock detect fix (bug #3531)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4986 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-xinclude/asterisk/lock.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 69aaaeefd..37c971ccd 100755
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -194,17 +194,19 @@ static inline int __ast_pthread_mutex_lock(char *filename, int lineno, char *fun
filename, lineno, func, mutex_name);
#endif
ast_mutex_init(t);
- }
+ }
#endif /* definded(AST_MUTEX_INIT_W_CONSTRUCTORS) || defined(AST_MUTEX_INIT_ON_FIRST_USE) */
#ifdef DETECT_DEADLOCKS
{
- time_t seconds seconds = time(NULL);
+ time_t seconds = time(NULL);
+ time_t current;
do {
res = pthread_mutex_trylock(&t->mutex);
if (res == EBUSY) {
- if ((time(NULL) - seconds) % 5) {
+ current = time(NULL);
+ if ((current - seconds) && (!((current - seconds) % 5))) {
fprintf(stderr, "%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
- filename, lineno, func, (time(NULL) - seconds), mutex_name);
+ filename, lineno, func, (int)(current - seconds), mutex_name);
fprintf(stderr, "%s line %d (%s): '%s' was locked here.\n",
t->file, t->lineno, t->func, mutex_name);
}