]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/thread-win32.c
Get rid of some warnings: -Wunused-result
[pulseaudio] / src / pulsecore / thread-win32.c
index 46d273b4148bdf455ae3a551092c5a70bd3fdbfb..7d458b977987347da31327765b429e8cb84c1dad 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of PulseAudio.
 
 /***
   This file is part of PulseAudio.
 
@@ -7,7 +5,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -53,9 +51,8 @@ struct pa_tls_monitor {
 };
 
 static pa_tls *thread_tls;
 };
 
 static pa_tls *thread_tls;
-static pa_once_t thread_tls_once = PA_ONCE_INIT;
+static pa_once thread_tls_once = PA_ONCE_INIT;
 static pa_tls *monitor_tls;
 static pa_tls *monitor_tls;
-static pa_once_t monitor_tls_once = PA_ONCE_INIT;
 
 static void thread_tls_once_func(void) {
     thread_tls = pa_tls_new(NULL);
 
 static void thread_tls_once_func(void) {
     thread_tls = pa_tls_new(NULL);
@@ -66,7 +63,7 @@ static DWORD WINAPI internal_thread_func(LPVOID param) {
     pa_thread *t = param;
     assert(t);
 
     pa_thread *t = param;
     assert(t);
 
-    pa_once(&thread_tls_once, thread_tls_once_func);
+    pa_run_once(&thread_tls_once, thread_tls_once_func);
     pa_tls_set(thread_tls, t);
 
     t->thread_func(t->userdata);
     pa_tls_set(thread_tls, t);
 
     t->thread_func(t->userdata);
@@ -74,8 +71,9 @@ static DWORD WINAPI internal_thread_func(LPVOID param) {
     return 0;
 }
 
     return 0;
 }
 
-pa_thread* pa_thread_new(pa_thread_func_t thread_func, void *userdata) {
+pa_thread* pa_thread_new(const char *name, pa_thread_func_t thread_func, void *userdata) {
     pa_thread *t;
     pa_thread *t;
+    DWORD thread_id;
 
     assert(thread_func);
 
 
     assert(thread_func);
 
@@ -83,7 +81,7 @@ pa_thread* pa_thread_new(pa_thread_func_t thread_func, void *userdata) {
     t->thread_func = thread_func;
     t->userdata = userdata;
 
     t->thread_func = thread_func;
     t->userdata = userdata;
 
-    t->thread = CreateThread(NULL, 0, internal_thread_func, t, 0, NULL);
+    t->thread = CreateThread(NULL, 0, internal_thread_func, t, 0, &thread_id);
 
     if (!t->thread) {
         pa_xfree(t);
 
     if (!t->thread) {
         pa_xfree(t);
@@ -122,7 +120,7 @@ int pa_thread_join(pa_thread *t) {
 }
 
 pa_thread* pa_thread_self(void) {
 }
 
 pa_thread* pa_thread_self(void) {
-    pa_once(&thread_tls_once, thread_tls_once_func);
+    pa_run_once(&thread_tls_once, thread_tls_once_func);
     return pa_tls_get(thread_tls);
 }
 
     return pa_tls_get(thread_tls);
 }
 
@@ -130,12 +128,6 @@ void pa_thread_yield(void) {
     Sleep(0);
 }
 
     Sleep(0);
 }
 
-static void monitor_tls_once_func(void) {
-    monitor_tls = pa_tls_new(NULL);
-    assert(monitor_tls);
-    pa_tls_set(monitor_tls, NULL);
-}
-
 static DWORD WINAPI monitor_thread_func(LPVOID param) {
     struct pa_tls_monitor *m = param;
     assert(m);
 static DWORD WINAPI monitor_thread_func(LPVOID param) {
     struct pa_tls_monitor *m = param;
     assert(m);
@@ -191,7 +183,11 @@ void *pa_tls_set(pa_tls *t, void *userdata) {
     if (t->free_func) {
         struct pa_tls_monitor *m;
 
     if (t->free_func) {
         struct pa_tls_monitor *m;
 
-        pa_once(&monitor_tls_once, monitor_tls_once_func);
+        PA_ONCE_BEGIN {
+            monitor_tls = pa_tls_new(NULL);
+            assert(monitor_tls);
+            pa_tls_set(monitor_tls, NULL);
+        } PA_ONCE_END;
 
         m = pa_tls_get(monitor_tls);
         if (!m) {
 
         m = pa_tls_get(monitor_tls);
         if (!m) {