[asterisk-commits] jpeeler: branch jpeeler/chan_dahdi r119075 - /team/jpeeler/chan_dahdi/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 29 15:28:37 CDT 2008


Author: jpeeler
Date: Thu May 29 15:28:36 2008
New Revision: 119075

URL: http://svn.digium.com/view/asterisk?view=rev&rev=119075
Log:
add changes from chan_zap in trunk

Modified:
    team/jpeeler/chan_dahdi/channels/chan_dahdi.c

Modified: team/jpeeler/chan_dahdi/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/jpeeler/chan_dahdi/channels/chan_dahdi.c?view=diff&rev=119075&r1=119074&r2=119075
==============================================================================
--- team/jpeeler/chan_dahdi/channels/chan_dahdi.c (original)
+++ team/jpeeler/chan_dahdi/channels/chan_dahdi.c Thu May 29 15:28:36 2008
@@ -873,10 +873,7 @@
 	do {
 		res = ast_mutex_trylock(&pri->lock);
 		if (res) {
-			ast_mutex_unlock(&pvt->lock);
-			/* Release the lock and try again */
-			usleep(1);
-			ast_mutex_lock(&pvt->lock);
+			DEADLOCK_AVOIDANCE(&pvt->lock);
 		}
 	} while (res);
 	/* Then break the poll */
@@ -967,9 +964,7 @@
 	for (;;) {
 		if (p->subs[a].owner) {
 			if (ast_channel_trylock(p->subs[a].owner)) {
-				ast_mutex_unlock(&p->lock);
-				usleep(1);
-				ast_mutex_lock(&p->lock);
+				DEADLOCK_AVOIDANCE(&p->lock);
 			} else {
 				ast_queue_frame(p->subs[a].owner, &ast_null_frame);
 				ast_channel_unlock(p->subs[a].owner);
@@ -1016,9 +1011,7 @@
 	for (;;) {
 		if (p->owner) {
 			if (ast_channel_trylock(p->owner)) {
-				ast_mutex_unlock(&p->lock);
-				usleep(1);
-				ast_mutex_lock(&p->lock);
+				DEADLOCK_AVOIDANCE(&p->lock);
 			} else {
 				ast_queue_frame(p->owner, f);
 				ast_channel_unlock(p->owner);
@@ -3619,9 +3612,7 @@
 		ast_mutex_lock(&master->lock);
 		if (slave) {
 			while (ast_mutex_trylock(&slave->lock)) {
-				ast_mutex_unlock(&master->lock);
-				usleep(1);
-				ast_mutex_lock(&master->lock);
+				DEADLOCK_AVOIDANCE(&master->lock);
 			}
 		}
 	}
@@ -10096,9 +10087,7 @@
 		for (x = 0; x < 3; x++) {
 			while (p->subs[x].owner && ast_channel_trylock(p->subs[x].owner)) {
 				redo++;
-				ast_mutex_unlock(&p->lock);
-				usleep(1);
-				ast_mutex_lock(&p->lock);
+				DEADLOCK_AVOIDANCE(&p->lock);
 			}
 			if (p->subs[x].owner) {
 				ast_queue_hangup_with_cause(p->subs[x].owner, AST_CAUSE_PRE_EMPTED);




More information about the asterisk-commits mailing list