diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/thread-test.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tests/thread-test.c b/src/tests/thread-test.c index 9e8afd9b..9559cdbb 100644 --- a/src/tests/thread-test.c +++ b/src/tests/thread-test.c @@ -25,6 +25,7 @@ #include <pulsecore/thread.h> #include <pulsecore/mutex.h> +#include <pulsecore/once.h> #include <pulsecore/log.h> #include <pulsecore/core-util.h> #include <pulse/xmalloc.h> @@ -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); |