[PATCH] thread: Add an optional index to the thread names.

Colin Guthrie colin at mageia.org
Tue Aug 9 06:52:57 PDT 2011


This just allows us to differentiate between sinks/sources when
multiple alsa-sinks are loaded.
---
 src/modules/alsa/alsa-sink.c                    |    2 +-
 src/modules/alsa/alsa-source.c                  |    2 +-
 src/modules/bluetooth/module-bluetooth-device.c |    2 +-
 src/modules/jack/module-jack-sink.c             |    2 +-
 src/modules/jack/module-jack-source.c           |    2 +-
 src/modules/macosx/module-coreaudio-device.c    |    2 +-
 src/modules/module-combine-sink.c               |    2 +-
 src/modules/module-esound-sink.c                |    2 +-
 src/modules/module-null-sink.c                  |    2 +-
 src/modules/module-null-source.c                |    2 +-
 src/modules/module-pipe-sink.c                  |    2 +-
 src/modules/module-pipe-source.c                |    2 +-
 src/modules/module-sine-source.c                |    2 +-
 src/modules/module-solaris.c                    |    2 +-
 src/modules/module-tunnel.c                     |   14 +++++++++-----
 src/modules/module-waveout.c                    |    2 +-
 src/modules/oss/module-oss.c                    |    2 +-
 src/modules/raop/module-raop-sink.c             |    2 +-
 src/pulse/thread-mainloop.c                     |    2 +-
 src/pulsecore/lock-autospawn.c                  |    2 +-
 src/pulsecore/thread-posix.c                    |   18 +++++++++++++-----
 src/pulsecore/thread-win32.c                    |    4 ++--
 src/pulsecore/thread.h                          |    6 +++---
 src/tests/asyncmsgq-test.c                      |    2 +-
 src/tests/asyncq-test.c                         |    4 ++--
 src/tests/flist-test.c                          |    2 +-
 src/tests/lock-autospawn-test.c                 |    8 ++++----
 src/tests/once-test.c                           |    2 +-
 src/tests/rtstutter.c                           |    2 +-
 src/tests/thread-test.c                         |    2 +-
 30 files changed, 57 insertions(+), 45 deletions(-)

diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
index 2394455..c8ff27b 100644
--- a/src/modules/alsa/alsa-sink.c
+++ b/src/modules/alsa/alsa-sink.c
@@ -2224,7 +2224,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
 
     pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
 
-    if (!(u->thread = pa_thread_new("alsa-sink", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("alsa-sink", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
index fa8d892..fb90dc8 100644
--- a/src/modules/alsa/alsa-source.c
+++ b/src/modules/alsa/alsa-source.c
@@ -1916,7 +1916,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
 
     pa_alsa_dump(PA_LOG_DEBUG, u->pcm_handle);
 
-    if (!(u->thread = pa_thread_new("alsa-source", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("alsa-source", u->source->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index efbc144..a214e72 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2471,7 +2471,7 @@ static int start_thread(struct userdata *u) {
         return 0;
     }
 
-    if (!(u->thread = pa_thread_new("bluetooth", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("bluetooth", PA_INVALID_INDEX, thread_func, u))) {
         pa_log_error("Failed to create IO thread");
         stop_thread(u);
         return -1;
diff --git a/src/modules/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c
index ba4ea95..1fbaafa 100644
--- a/src/modules/jack/module-jack-sink.c
+++ b/src/modules/jack/module-jack-sink.c
@@ -416,7 +416,7 @@ int pa__init(pa_module*m) {
     jack_set_thread_init_callback(u->client, jack_init, u);
     jack_set_buffer_size_callback(u->client, jack_buffer_size, u);
 
-    if (!(u->thread = pa_thread_new("jack-sink", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("jack-sink", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/jack/module-jack-source.c b/src/modules/jack/module-jack-source.c
index 13109f3..4a2bab4 100644
--- a/src/modules/jack/module-jack-source.c
+++ b/src/modules/jack/module-jack-source.c
@@ -360,7 +360,7 @@ int pa__init(pa_module*m) {
     jack_on_shutdown(u->client, jack_shutdown, u);
     jack_set_thread_init_callback(u->client, jack_init, u);
 
-    if (!(u->thread = pa_thread_new("jack-source", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("jack-source", u->source->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c
index d276281..afa3a41 100644
--- a/src/modules/macosx/module-coreaudio-device.c
+++ b/src/modules/macosx/module-coreaudio-device.c
@@ -757,7 +757,7 @@ int pa__init(pa_module *m) {
     ca_device_create_streams(m, TRUE);
 
     /* create the message thread */
-    if (!(u->thread = pa_thread_new(u->device_name, thread_func, u))) {
+    if (!(u->thread = pa_thread_new(u->device_name, u->card->index, u->thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c
index 8bdc5b7..b317c32 100644
--- a/src/modules/module-combine-sink.c
+++ b/src/modules/module-combine-sink.c
@@ -1333,7 +1333,7 @@ int pa__init(pa_module*m) {
     u->sink_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK], PA_HOOK_EARLY, (pa_hook_cb_t) sink_unlink_hook_cb, u);
     u->sink_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_state_changed_hook_cb, u);
 
-    if (!(u->thread = pa_thread_new("combine", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("combine", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c
index d79054f..782e233 100644
--- a/src/modules/module-esound-sink.c
+++ b/src/modules/module-esound-sink.c
@@ -634,7 +634,7 @@ int pa__init(pa_module*m) {
     /* Reserve space for the response */
     u->read_data = pa_xmalloc(u->read_length = sizeof(int32_t));
 
-    if (!(u->thread = pa_thread_new("esound-sink", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("esound-sink", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c
index 10868f5..bde30e3 100644
--- a/src/modules/module-null-sink.c
+++ b/src/modules/module-null-sink.c
@@ -310,7 +310,7 @@ int pa__init(pa_module*m) {
     pa_sink_set_max_rewind(u->sink, nbytes);
     pa_sink_set_max_request(u->sink, nbytes);
 
-    if (!(u->thread = pa_thread_new("null-sink", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("null-sink", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-null-source.c b/src/modules/module-null-source.c
index b3ece7b..4ab8eb6 100644
--- a/src/modules/module-null-source.c
+++ b/src/modules/module-null-source.c
@@ -241,7 +241,7 @@ int pa__init(pa_module*m) {
     u->source->thread_info.max_rewind =
         pa_usec_to_bytes(u->block_usec, &u->source->sample_spec);
 
-    if (!(u->thread = pa_thread_new("null-source", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("null-source", u->source->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index 91e01f9..7b8c5fb 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -309,7 +309,7 @@ int pa__init(pa_module*m) {
     pollfd->fd = u->fd;
     pollfd->events = pollfd->revents = 0;
 
-    if (!(u->thread = pa_thread_new("pipe-sink", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("pipe-sink", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index a941f08..f5740dd 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -293,7 +293,7 @@ int pa__init(pa_module*m) {
     pollfd->fd = u->fd;
     pollfd->events = pollfd->revents = 0;
 
-    if (!(u->thread = pa_thread_new("pipe-source", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("pipe-source", u->source->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-sine-source.c b/src/modules/module-sine-source.c
index 20a6868..5bc7b3d 100644
--- a/src/modules/module-sine-source.c
+++ b/src/modules/module-sine-source.c
@@ -266,7 +266,7 @@ int pa__init(pa_module*m) {
     pa_source_set_rtpoll(u->source, u->rtpoll);
     pa_source_set_fixed_latency(u->source, u->block_usec);
 
-    if (!(u->thread = pa_thread_new("sine-source", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("sine-source", u->source->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c
index 61ea68c..dd18a89 100644
--- a/src/modules/module-solaris.c
+++ b/src/modules/module-solaris.c
@@ -1010,7 +1010,7 @@ int pa__init(pa_module *m) {
     else
         pa_log_warn("Could not register SIGPOLL handler");
 
-    if (!(u->thread = pa_thread_new("solaris", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("solaris", PA_INVALID_INDEX, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c
index faee995..2a016c7 100644
--- a/src/modules/module-tunnel.c
+++ b/src/modules/module-tunnel.c
@@ -2080,20 +2080,24 @@ int pa__init(pa_module*m) {
     u->time_event = NULL;
 
     u->maxlength = (uint32_t) -1;
+
 #ifdef TUNNEL_SINK
     u->tlength = u->minreq = u->prebuf = (uint32_t) -1;
-#else
-    u->fragsize = (uint32_t) -1;
-#endif
 
-    if (!(u->thread = pa_thread_new("module-tunnel", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("tunnel-sink", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
 
-#ifdef TUNNEL_SINK
     pa_sink_put(u->sink);
 #else
+    u->fragsize = (uint32_t) -1;
+
+    if (!(u->thread = pa_thread_new("tunnel-source", u->source->index, thread_func, u))) {
+        pa_log("Failed to create thread.");
+        goto fail;
+    }
+
     pa_source_put(u->source);
 #endif
 
diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c
index 53efce9..8045690 100644
--- a/src/modules/module-waveout.c
+++ b/src/modules/module-waveout.c
@@ -698,7 +698,7 @@ int pa__init(pa_module *m) {
         pa_source_set_rtpoll(u->source, u->rtpoll);
     }
 
-    if (!(u->thread = pa_thread_new("waveout", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("waveout", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c
index 6f0f271..5e201ba 100644
--- a/src/modules/oss/module-oss.c
+++ b/src/modules/oss/module-oss.c
@@ -1449,7 +1449,7 @@ go_on:
 
     pa_memchunk_reset(&u->memchunk);
 
-    if (!(u->thread = pa_thread_new("oss", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("oss", PA_INVALID_INDEX, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/modules/raop/module-raop-sink.c b/src/modules/raop/module-raop-sink.c
index 422f05c..cfcf4e8 100644
--- a/src/modules/raop/module-raop-sink.c
+++ b/src/modules/raop/module-raop-sink.c
@@ -609,7 +609,7 @@ int pa__init(pa_module*m) {
     pa_raop_client_set_callback(u->raop, on_connection, u);
     pa_raop_client_set_closed_callback(u->raop, on_close, u);
 
-    if (!(u->thread = pa_thread_new("raop-sink", thread_func, u))) {
+    if (!(u->thread = pa_thread_new("raop-sink", u->sink->index, thread_func, u))) {
         pa_log("Failed to create thread.");
         goto fail;
     }
diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c
index aa56a92..a6adc15 100644
--- a/src/pulse/thread-mainloop.c
+++ b/src/pulse/thread-mainloop.c
@@ -140,7 +140,7 @@ int pa_threaded_mainloop_start(pa_threaded_mainloop *m) {
 
     pa_assert(!m->thread || !pa_thread_is_running(m->thread));
 
-    if (!(m->thread = pa_thread_new("threaded-ml", thread, m)))
+    if (!(m->thread = pa_thread_new("threaded-ml", PA_INVALID_INDEX, thread, m)))
         return -1;
 
     return 0;
diff --git a/src/pulsecore/lock-autospawn.c b/src/pulsecore/lock-autospawn.c
index b1d414b..af17aac 100644
--- a/src/pulsecore/lock-autospawn.c
+++ b/src/pulsecore/lock-autospawn.c
@@ -249,7 +249,7 @@ finish:
 static int start_thread(void) {
 
     if (!thread)
-        if (!(thread = pa_thread_new("autospawn", thread_func, NULL)))
+        if (!(thread = pa_thread_new("autospawn", PA_INVALID_INDEX, thread_func, NULL)))
             return -1;
 
     return 0;
diff --git a/src/pulsecore/thread-posix.c b/src/pulsecore/thread-posix.c
index 3f4ae5c..1a41493 100644
--- a/src/pulsecore/thread-posix.c
+++ b/src/pulsecore/thread-posix.c
@@ -86,13 +86,16 @@ static void* internal_thread_func(void *userdata) {
     return NULL;
 }
 
-pa_thread* pa_thread_new(const char *name, pa_thread_func_t thread_func, void *userdata) {
+pa_thread* pa_thread_new(const char *name, uint32_t idx, pa_thread_func_t thread_func, void *userdata) {
     pa_thread *t;
 
     pa_assert(thread_func);
 
     t = pa_xnew0(pa_thread, 1);
-    t->name = pa_xstrdup(name);
+    if (idx == PA_INVALID_INDEX)
+        t->name = pa_xstrdup(name);
+    else
+        t->name = pa_sprintf_malloc("%s (#%d)", name, idx);
     t->thread_func = thread_func;
     t->userdata = userdata;
 
@@ -169,16 +172,21 @@ void pa_thread_set_data(pa_thread *t, void *userdata) {
     t->userdata = userdata;
 }
 
-void pa_thread_set_name(pa_thread *t, const char *name) {
+void pa_thread_set_name(pa_thread *t, const char *name, uint32_t idx) {
     pa_assert(t);
 
     pa_xfree(t->name);
     t->name = pa_xstrdup(name);
 
+    if (idx == PA_INVALID_INDEX)
+        t->name = pa_xstrdup(name);
+    else
+        t->name = pa_sprintf_malloc("%s #%d", name, idx);
+
 #ifdef __linux__
-    prctl(PR_SET_NAME, name);
+    prctl(PR_SET_NAME, t->name);
 #elif defined(HAVE_PTHREAD_SETNAME_NP) && defined(OS_IS_DARWIN)
-    pthread_setname_np(name);
+    pthread_setname_np(t->name);
 #endif
 }
 
diff --git a/src/pulsecore/thread-win32.c b/src/pulsecore/thread-win32.c
index 89c8c46..2be87f7 100644
--- a/src/pulsecore/thread-win32.c
+++ b/src/pulsecore/thread-win32.c
@@ -70,7 +70,7 @@ static DWORD WINAPI internal_thread_func(LPVOID param) {
     return 0;
 }
 
-pa_thread* pa_thread_new(const char *name, pa_thread_func_t thread_func, void *userdata) {
+pa_thread* pa_thread_new(const char *name, uint32_t idx, pa_thread_func_t thread_func, void *userdata) {
     pa_thread *t;
     DWORD thread_id;
 
@@ -135,7 +135,7 @@ void pa_thread_set_data(pa_thread *t, void *userdata) {
     t->userdata = userdata;
 }
 
-void pa_thread_set_name(pa_thread *t, const char *name) {
+void pa_thread_set_name(pa_thread *t, const char *name, uint32_t idx) {
     /* Not implemented */
 }
 
diff --git a/src/pulsecore/thread.h b/src/pulsecore/thread.h
index 9cabb89..a4b21ce 100644
--- a/src/pulsecore/thread.h
+++ b/src/pulsecore/thread.h
@@ -21,7 +21,7 @@
   License along with PulseAudio; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   USA.
-***/
+// ***/
 
 #include <pulse/def.h>
 #include <pulse/gccmacro.h>
@@ -37,7 +37,7 @@ typedef struct pa_thread pa_thread;
 
 typedef void (*pa_thread_func_t) (void *userdata);
 
-pa_thread* pa_thread_new(const char *name, pa_thread_func_t thread_func, void *userdata);
+pa_thread* pa_thread_new(const char *name, uint32_t idx, pa_thread_func_t thread_func, void *userdata);
 void pa_thread_free(pa_thread *t);
 int pa_thread_join(pa_thread *t);
 int pa_thread_is_running(pa_thread *t);
@@ -48,7 +48,7 @@ void* pa_thread_get_data(pa_thread *t);
 void pa_thread_set_data(pa_thread *t, void *userdata);
 
 const char *pa_thread_get_name(pa_thread *t);
-void pa_thread_set_name(pa_thread *t, const char *name);
+void pa_thread_set_name(pa_thread *t, const char *name, uint32_t idx);
 
 typedef struct pa_tls pa_tls;
 
diff --git a/src/tests/asyncmsgq-test.c b/src/tests/asyncmsgq-test.c
index 96e5a0d..c954c67 100644
--- a/src/tests/asyncmsgq-test.c
+++ b/src/tests/asyncmsgq-test.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[]) {
 
     pa_assert_se(q = pa_asyncmsgq_new(0));
 
-    pa_assert_se(t = pa_thread_new("test", the_thread, q));
+    pa_assert_se(t = pa_thread_new("test", PA_INVALID_INDEX, the_thread, q));
 
     printf("Operation A post\n");
     pa_asyncmsgq_post(q, NULL, OPERATION_A, NULL, 0, NULL, NULL);
diff --git a/src/tests/asyncq-test.c b/src/tests/asyncq-test.c
index 46bac9f..a239dd2 100644
--- a/src/tests/asyncq-test.c
+++ b/src/tests/asyncq-test.c
@@ -71,8 +71,8 @@ int main(int argc, char *argv[]) {
 
     pa_assert_se(q = pa_asyncq_new(0));
 
-    pa_assert_se(t1 = pa_thread_new("producer", producer, q));
-    pa_assert_se(t2 = pa_thread_new("consumer", consumer, q));
+    pa_assert_se(t1 = pa_thread_new("producer", PA_INVALID_INDEX, producer, q));
+    pa_assert_se(t2 = pa_thread_new("consumer", PA_INVALID_INDEX, consumer, q));
 
     pa_thread_free(t1);
     pa_thread_free(t2);
diff --git a/src/tests/flist-test.c b/src/tests/flist-test.c
index 6915204..b1e831b 100644
--- a/src/tests/flist-test.c
+++ b/src/tests/flist-test.c
@@ -87,7 +87,7 @@ int main(int argc, char* argv[]) {
     flist = pa_flist_new(0);
 
     for (i = 0; i < THREADS_MAX; i++) {
-        threads[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1));
+        threads[i] = pa_thread_new("test", PA_INVALID_INDEX, thread_func, pa_sprintf_malloc("Thread #%i", i+1));
         assert(threads[i]);
     }
 
diff --git a/src/tests/lock-autospawn-test.c b/src/tests/lock-autospawn-test.c
index 9ba6129..f647b4c 100644
--- a/src/tests/lock-autospawn-test.c
+++ b/src/tests/lock-autospawn-test.c
@@ -88,10 +88,10 @@ static void thread_func2(void *k) {
 int main(int argc, char**argv) {
     pa_thread *a, *b, *c, *d;
 
-    pa_assert_se((a = pa_thread_new("test1", thread_func, PA_INT_TO_PTR(1))));
-    pa_assert_se((b = pa_thread_new("test2", thread_func2, PA_INT_TO_PTR(2))));
-    pa_assert_se((c = pa_thread_new("test3", thread_func2, PA_INT_TO_PTR(3))));
-    pa_assert_se((d = pa_thread_new("test4", thread_func, PA_INT_TO_PTR(4))));
+    pa_assert_se((a = pa_thread_new("test1", PA_INVALID_INDEX, thread_func, PA_INT_TO_PTR(1))));
+    pa_assert_se((b = pa_thread_new("test2", PA_INVALID_INDEX, thread_func2, PA_INT_TO_PTR(2))));
+    pa_assert_se((c = pa_thread_new("test3", PA_INVALID_INDEX, thread_func2, PA_INT_TO_PTR(3))));
+    pa_assert_se((d = pa_thread_new("test4", PA_INVALID_INDEX, thread_func, PA_INT_TO_PTR(4))));
 
     pa_thread_join(a);
     pa_thread_join(b);
diff --git a/src/tests/once-test.c b/src/tests/once-test.c
index 8a9995d..09699f2 100644
--- a/src/tests/once-test.c
+++ b/src/tests/once-test.c
@@ -86,7 +86,7 @@ int main(int argc, char *argv[]) {
         pa_zero(once);
 
         for (i = 0; i < N_THREADS; i++)
-            threads[i] = pa_thread_new("once", thread_func, pa_sprintf_malloc("Thread #%i", i+1));
+            threads[i] = pa_thread_new("once", PA_INVALID_INDEX, thread_func, pa_sprintf_malloc("Thread #%i", i+1));
 
         for (i = 0; i < N_THREADS; i++)
             pa_thread_join(threads[i]);
diff --git a/src/tests/rtstutter.c b/src/tests/rtstutter.c
index 739683d..98e58da 100644
--- a/src/tests/rtstutter.c
+++ b/src/tests/rtstutter.c
@@ -108,7 +108,7 @@ int main(int argc, char*argv[]) {
     pa_log_notice("Creating random latencies in the range of %ims to %ims.", msec_lower, msec_upper);
 
     for (n = 1; n < pa_ncpus(); n++) {
-        pa_assert_se(pa_thread_new("rtstutter", work, PA_UINT_TO_PTR(n)));
+        pa_assert_se(pa_thread_new("rtstutter", PA_INVALID_INDEX, work, PA_UINT_TO_PTR(n)));
     }
 
     work(PA_INT_TO_PTR(0));
diff --git a/src/tests/thread-test.c b/src/tests/thread-test.c
index 4071e42..5ff4b94 100644
--- a/src/tests/thread-test.c
+++ b/src/tests/thread-test.c
@@ -100,7 +100,7 @@ int main(int argc, char *argv[]) {
     tls = pa_tls_new(pa_xfree);
 
     for (i = 0; i < THREADS_MAX; i++) {
-        t[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1));
+        t[i] = pa_thread_new("test", PA_INVALID_INDEX, thread_func, pa_sprintf_malloc("Thread #%i", i+1));
         assert(t[i]);
     }
 
-- 
1.7.6


--------------070007040404050109040706--


More information about the pulseaudio-discuss mailing list