[asterisk-commits] rmudgett: branch rmudgett/mcid r253480 - /team/rmudgett/mcid/channels/sig_pri.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 18 18:36:01 CDT 2010
Author: rmudgett
Date: Thu Mar 18 18:35:57 2010
New Revision: 253480
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=253480
Log:
Reorder the new MCID functions.
Modified:
team/rmudgett/mcid/channels/sig_pri.c
Modified: team/rmudgett/mcid/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/mcid/channels/sig_pri.c?view=diff&rev=253480&r1=253479&r2=253480
==============================================================================
--- team/rmudgett/mcid/channels/sig_pri.c (original)
+++ team/rmudgett/mcid/channels/sig_pri.c Thu Mar 18 18:35:57 2010
@@ -1450,6 +1450,37 @@
return 0;
}
+/*!
+ * \internal
+ * \brief Obtain the sig_pri owner channel lock if the owner exists.
+ * \since 1.8
+ *
+ * \param pri sig_pri PRI control structure.
+ * \param chanpos Channel position in the span.
+ *
+ * \note Assumes the pri->lock is already obtained.
+ * \note Assumes the sig_pri_lock_private(pri->pvts[chanpos]) is already obtained.
+ *
+ * \return Nothing
+ */
+static void sig_pri_lock_owner(struct sig_pri_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);
+ PRI_DEADLOCK_AVOIDANCE(pri->pvts[chanpos]);
+ ast_mutex_lock(&pri->lock);
+ }
+}
+
#if defined(HAVE_PRI_MCID)
/*!
* \internal
@@ -1541,37 +1572,6 @@
ast_free(msg);
}
#endif /* defined(HAVE_PRI_MCID) */
-
-/*!
- * \internal
- * \brief Obtain the sig_pri owner channel lock if the owner exists.
- * \since 1.8
- *
- * \param pri sig_pri PRI control structure.
- * \param chanpos Channel position in the span.
- *
- * \note Assumes the pri->lock is already obtained.
- * \note Assumes the sig_pri_lock_private(pri->pvts[chanpos]) is already obtained.
- *
- * \return Nothing
- */
-static void sig_pri_lock_owner(struct sig_pri_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);
- PRI_DEADLOCK_AVOIDANCE(pri->pvts[chanpos]);
- ast_mutex_lock(&pri->lock);
- }
-}
/*!
* \internal
More information about the asterisk-commits
mailing list