aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-09 21:55:06 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-09 21:55:06 +0000
commita8e66dc137a198d1d429c2129ef630bee848a820 (patch)
tree75f56f11bcfbb63b11fa03eb407cf5e75404694b /include
parent32f9ef55236ee53de4ec3ad1f6a210658f254bbb (diff)
This commit fixes the following issues:
- Deadlock in ast_write (issue #10406) - Deadlock in ast_read (issue #10406) - Possible mutex initialization error in lock.h (issue #10571) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@85158 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/lock.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index d80726f5a..da39adeaf 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -149,6 +149,11 @@ void ast_store_lock_info(enum ast_lock_type type, const char *filename,
void ast_mark_lock_acquired(void);
/*!
+ * \brief Mark the last lock as failed (trylock)
+ */
+void ast_mark_lock_failed(void);
+
+/*!
* \brief remove lock info for the current thread
*
* this gets called by ast_mutex_unlock so that information on the lock can
@@ -165,6 +170,7 @@ static inline int __ast_pthread_mutex_init_attr(int track, const char *filename,
const char *mutex_name, ast_mutex_t *t,
pthread_mutexattr_t *attr)
{
+ int i;
#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
int canlog = strcmp(filename, "logger.c");
@@ -180,10 +186,12 @@ static inline int __ast_pthread_mutex_init_attr(int track, const char *filename,
}
#endif
- t->file[0] = filename;
- t->lineno[0] = lineno;
- t->func[0] = func;
- t->thread[0] = 0;
+ for (i = 0; i < AST_MAX_REENTRANCY; i++) {
+ t->file[i] = NULL;
+ t->lineno[i] = 0;
+ t->func[i] = NULL;
+ t->thread[i] = 0;
+ }
t->reentrancy = 0;
t->track = track;