aboutsummaryrefslogtreecommitdiffstats
path: root/channels/sig_pri.c
diff options
context:
space:
mode:
authorrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2011-04-08 16:17:32 +0000
committerrmudgett <rmudgett@f38db490-d61c-443f-a65b-d21fe96a405b>2011-04-08 16:17:32 +0000
commit0c126d16218a9ede34b72550f7c24d26763611c4 (patch)
treea50d5fded9b71f7c7c9ee5410731a2df5999e852 /channels/sig_pri.c
parentd192b8023cb8e5120c6e789c3f4306d0f31c0bd5 (diff)
Add private lock deadlock avoidance callback to PRI and SS7.
Factor out the equivalent function for analog. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@313100 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/sig_pri.c')
-rw-r--r--channels/sig_pri.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/channels/sig_pri.c b/channels/sig_pri.c
index e76db86ac..308fa5dc8 100644
--- a/channels/sig_pri.c
+++ b/channels/sig_pri.c
@@ -321,6 +321,16 @@ static void sig_pri_lock_private(struct sig_pri_chan *p)
p->calls->lock_private(p->chan_pvt);
}
+static void sig_pri_deadlock_avoidance_private(struct sig_pri_chan *p)
+{
+ if (p->calls->deadlock_avoidance_private) {
+ p->calls->deadlock_avoidance_private(p->chan_pvt);
+ } else {
+ /* Fallback to the old way if callback not present. */
+ PRI_DEADLOCK_AVOIDANCE(p);
+ }
+}
+
static inline int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
{
int res;
@@ -328,7 +338,7 @@ static inline int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
do {
res = ast_mutex_trylock(&pri->lock);
if (res) {
- PRI_DEADLOCK_AVOIDANCE(p);
+ sig_pri_deadlock_avoidance_private(p);
}
} while (res);
/* Then break the poll */
@@ -1123,7 +1133,7 @@ static void sig_pri_lock_owner(struct sig_pri_span *pri, int chanpos)
}
/* We must unlock the PRI to avoid the possibility of a deadlock */
ast_mutex_unlock(&pri->lock);
- PRI_DEADLOCK_AVOIDANCE(pri->pvts[chanpos]);
+ sig_pri_deadlock_avoidance_private(pri->pvts[chanpos]);
ast_mutex_lock(&pri->lock);
}
}