diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-25 01:08:37 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-06-25 01:08:37 +0000 |
commit | e8943c25e55dd214c40ab2f84feb9d916a44abfc (patch) | |
tree | 54c876bb29fc103e5525301e8ae9ce74877663d1 /include | |
parent | 6f29ea12b463fc3947e50577802b46cbee30c6d6 (diff) |
Merged revisions 124965 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r124965 | tilghman | 2008-06-24 19:46:24 -0500 (Tue, 24 Jun 2008) | 7 lines
Pvt deadlock causes some channels to get stuck in Reserved status.
(closes issue #12621)
Reported by: fabianoheringer
Patches:
20080612__bug12621.diff.txt uploaded by Corydon76 (license 14)
Tested by: fabianoheringer
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@124966 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/lock.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h index 516c4627f..3f261c6a3 100644 --- a/include/asterisk/lock.h +++ b/include/asterisk/lock.h @@ -261,6 +261,20 @@ int ast_find_lock_info(void *lock_addr, const char **filename, int *lineno, cons * used during deadlock avoidance, to preserve the original location where * a lock was originally acquired. */ +#define CHANNEL_DEADLOCK_AVOIDANCE(chan) \ + do { \ + const char *__filename, *__func, *__mutex_name; \ + int __lineno; \ + int __res = ast_find_lock_info(&chan->lock_dont_use, &__filename, &__lineno, &__func, &__mutex_name); \ + ast_channel_unlock(chan); \ + usleep(1); \ + if (__res < 0) { /* Shouldn't ever happen, but just in case... */ \ + ast_channel_lock(chan); \ + } else { \ + __ast_pthread_mutex_lock(__filename, __lineno, __func, __mutex_name, &chan->lock_dont_use); \ + } \ + } while (0) + #define DEADLOCK_AVOIDANCE(lock) \ do { \ const char *__filename, *__func, *__mutex_name; \ @@ -1405,6 +1419,11 @@ static inline int _ast_rwlock_trywrlock(ast_rwlock_t *t, const char *name, #else /* !DEBUG_THREADS */ +#define CHANNEL_DEADLOCK_AVOIDANCE(chan) \ + ast_channel_lock(chan); \ + usleep(1); \ + ast_channel_unlock(chan); + #define DEADLOCK_AVOIDANCE(lock) \ ast_mutex_lock(lock); \ usleep(1); \ |