]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/thread-win32.c
thread-win32: Implement pa_thread_free_nojoin()
[pulseaudio] / src / pulsecore / thread-win32.c
index c40d33428e3f2f17073c104e608abc2df1ff6abb..0fa3b917fc3297b66f628c862311e8b018aaa032 100644 (file)
@@ -5,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
-  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
@@ -28,7 +28,6 @@
 #include <windows.h>
 
 #include <pulse/xmalloc.h>
-#include <pulsecore/log.h>
 #include <pulsecore/once.h>
 
 #include "thread.h"
@@ -71,8 +70,9 @@ static DWORD WINAPI internal_thread_func(LPVOID param) {
     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;
+    DWORD thread_id;
 
     assert(thread_func);
 
@@ -80,7 +80,7 @@ pa_thread* pa_thread_new(pa_thread_func_t thread_func, void *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);
@@ -109,6 +109,13 @@ void pa_thread_free(pa_thread *t) {
     pa_xfree(t);
 }
 
+void pa_thread_free_nojoin(pa_thread *t) {
+    pa_assert(t);
+
+    CloseHandle(t->thread);
+    pa_xfree(t);
+}
+
 int pa_thread_join(pa_thread *t) {
     assert(t);
 
@@ -123,6 +130,27 @@ pa_thread* pa_thread_self(void) {
     return pa_tls_get(thread_tls);
 }
 
+void* pa_thread_get_data(pa_thread *t) {
+    pa_assert(t);
+
+    return t->userdata;
+}
+
+void pa_thread_set_data(pa_thread *t, void *userdata) {
+    pa_assert(t);
+
+    t->userdata = userdata;
+}
+
+void pa_thread_set_name(pa_thread *t, const char *name) {
+    /* Not implemented */
+}
+
+const char *pa_thread_get_name(pa_thread *t) {
+    /* Not implemented */
+    return NULL;
+}
+
 void pa_thread_yield(void) {
     Sleep(0);
 }