Modified: team/group/issue14068/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/issue14068/channels/chan_dahdi.c?view=diff&rev=197695&r1=197694&r2=197695
==============================================================================
--- team/group/issue14068/channels/chan_dahdi.c (original)
+++ team/group/issue14068/channels/chan_dahdi.c Thu May 28 13:20:19 2009
@@ -12831,15 +12831,49 @@
#if defined(HAVE_PRI)
/*!
* \internal
- * \brief Handle the PRI subcommand events.
+ * \brief Obtain the DAHDI owner channel lock if the owner exists.
* \since 1.6.3
*
- * \param pri DAHDI PRI private structure.
+ * \param pri DAHDI PRI control structure.
+ * \param chanpos Channel position in the span.
+ *
+ * \note Assumes the pri->lock is already obtained.
+ * \note Assumes the pri->pvts[chanpos]->lock is already obtained.
+ *
+ * \return Nothing
+ */
+static void dahdi_pri_lock_owner(struct dahdi_pri *pri, int chanpos)
+{
+ for (;;) {
+ if (!pri->pvts[chanpos]->owner) {
+ /* There is no owner lock to get. */
+ break;
+ }
+ if (!ast_channel_trylock(pri->pvts[chanpos]->owner)) {
+ /* We got the lock */
+ break;
+ }
+ /* We must unlock the PRI to avoid the possibility of a deadlock */
+ ast_mutex_unlock(&pri->lock);
+ DEADLOCK_AVOIDANCE(&pri->pvts[chanpos]->lock);
+ ast_mutex_lock(&pri->lock);
+ }
+}
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
+/*!
+ * \internal
+ * \brief Handle the call associated PRI subcommand events.
+ * \since 1.6.3
+ *
+ * \param pri DAHDI PRI control structure.
* \param chanpos Channel position in the span.
* \param event_id PRI event id
* \param channel PRI encoded span/channel
* \param subcmds Subcommands to process if any. (Could be NULL).
*
+ * \note Assumes the pri->lock is already obtained.
* \note Assumes the pri->pvts[chanpos]->lock is already obtained.
*
* \return Nothing
@@ -12847,6 +12881,7 @@
static void dahdi_pri_handle_subcmds(struct dahdi_pri *pri, int chanpos, int event_id, int channel, const struct pri_subcommands *subcmds)
{
int index;
+ struct ast_channel *owner;
if (!subcmds) {
return;
@@ -12854,10 +12889,10 @@
//ast_mutex_lock(&pri->pvts[chanpos]->lock);
for (index = 0; index < subcmds->counter_subcmd; ++index) {
const struct pri_subcommand *subcmd = &subcmds->subcmd[index];
- struct ast_channel *owner;
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum