From 3ae98db1aa01cfe68ed55f303fecf9c9bbcb4438 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 9 Sep 2006 23:54:56 +0000 Subject: [PATCH] add pa_once testing code git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1388 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/tests/thread-test.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/tests/thread-test.c b/src/tests/thread-test.c index 9e8afd9..9559cdb 100644 --- a/src/tests/thread-test.c +++ b/src/tests/thread-test.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,12 @@ static int magic_number = 0; #define THREADS_MAX 20 +static void once_func(void) { + pa_log("once!"); +} + +static pa_once_t once = PA_ONCE_INIT; + static void thread_func(void *data) { pa_tls_set(tls, data); @@ -65,6 +72,8 @@ static void thread_func(void *data) { pa_mutex_unlock(mutex); + pa_once(&once, once_func); + pa_cond_signal(cond2, 0); pa_log("%s got number %i", (char*) pa_tls_get(tls), k); -- 2.7.4