--- channel.modif 2009-03-09 16:37:31.000000000 -0300 +++ channel.c 2009-03-07 20:06:37.000000000 -0300 @@ -4214,17 +4214,10 @@ ast_log(LOG_DEBUG, "Unbridge signal received. Ending native bridge.\n"); continue; } - - ast_mutex_lock(&c0->lock); - while(ast_mutex_trylock(&c1->lock)) { - ast_mutex_unlock(&c0->lock); - usleep(1); - ast_mutex_lock(&c0->lock); - } - + /* Stop if we're a zombie or need a soft hangup */ - if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup(c0) || - ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup(c1)) { + if (ast_test_flag(c0, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c0) || + ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1)) { *fo = NULL; if (who) *rc = who; @@ -4236,8 +4229,6 @@ ast_check_hangup(c0) ? "Yes" : "No", ast_test_flag(c1, AST_FLAG_ZOMBIE) ? "Yes" : "No", ast_check_hangup(c1) ? "Yes" : "No"); - ast_mutex_unlock(&c1->lock); - ast_mutex_unlock(&c0->lock); break; } @@ -4247,9 +4238,6 @@ if (!ast_strlen_zero(pbx_builtin_getvar_helper(c1, "BRIDGEPEER"))) pbx_builtin_setvar_helper(c1, "BRIDGEPEER", c0->name); - ast_mutex_unlock(&c1->lock); - ast_mutex_unlock(&c0->lock); - if (c0->tech->bridge && (config->timelimit == 0) && (c0->tech->bridge == c1->tech->bridge) &&