From: Jaroslav Kysela Date: Wed, 6 Oct 2010 16:51:29 +0000 (+0200) Subject: alsaloop: Fix thread handling X-Git-Tag: v1.0.24~28 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=4fe4d22b73dd205521348583f8105de1c155f4a6;p=alsa-utils.git alsaloop: Fix thread handling Signed-off-by: Jaroslav Kysela --- diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c index 0001358..743e0ef 100644 --- a/alsaloop/alsaloop.c +++ b/alsaloop/alsaloop.c @@ -687,7 +687,7 @@ int main(int argc, char *argv[]) } /* we must sort thread IDs */ - j = 0; + j = -1; do { k = 0x7fffffff; for (i = 0; i < loopbacks_count; i++) { @@ -695,11 +695,11 @@ int main(int argc, char *argv[]) loopbacks[i]->thread > j) k = loopbacks[i]->thread; } + j++; for (i = 0; i < loopbacks_count; i++) { if (loopbacks[i]->thread == k) loopbacks[i]->thread = j; } - j++; } while (k != 0x7fffffff); /* fix maximum thread id */ for (i = 0, j = -1; i < loopbacks_count; i++) { @@ -729,7 +729,6 @@ int main(int argc, char *argv[]) for (k = 0; k < j; k++) thread_job(&threads[k]); - logit(LOG_CRIT, "threads = %i %i\n", j, loopbacks_count); if (j > 1) { for (k = 0; k < j; k++) pthread_join(threads[k].thread, NULL); diff --git a/alsaloop/test.sh b/alsaloop/test.sh index 2033add..bc42480 100755 --- a/alsaloop/test.sh +++ b/alsaloop/test.sh @@ -27,8 +27,27 @@ EOF $DBG ./alsaloop -d --config $CFGFILE } +test3() { + echo "TEST2" +cat > $CFGFILE <