[vlc-devel] [PATCH 1/2] win32: thread: remove unused detached thread support

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 9 15:10:07 CET 2020


Following a10ac09d42601cdf0671a58f5f971e7665e7e8d6
---
 src/win32/thread.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 3879b463883..8f17b8131ec 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -360,12 +360,10 @@ __stdcall vlc_entry (void *p)
     th->data = th->entry (th->data);
     TlsSetValue(thread_key, NULL);
 
-    if (th->id == NULL) /* Detached thread */
-        vlc_thread_destroy(th);
     return 0;
 }
 
-static int vlc_clone_attr (vlc_thread_t *p_handle, bool detached,
+static int vlc_clone_attr (vlc_thread_t *p_handle,
                            void *(*entry) (void *), void *data, int priority)
 {
     struct vlc_thread *th = malloc (sizeof (*th));
@@ -396,13 +394,7 @@ static int vlc_clone_attr (vlc_thread_t *p_handle, bool detached,
         return err;
     }
 
-    if (detached)
-    {
-        CloseHandle(h);
-        th->id = NULL;
-    }
-    else
-        th->id = h;
+    th->id = h;
 
     if (p_handle != NULL)
         *p_handle = th;
@@ -416,7 +408,7 @@ static int vlc_clone_attr (vlc_thread_t *p_handle, bool detached,
 int vlc_clone (vlc_thread_t *p_handle, void *(*entry) (void *),
                 void *data, int priority)
 {
-    return vlc_clone_attr (p_handle, false, entry, data, priority);
+    return vlc_clone_attr (p_handle, entry, data, priority);
 }
 
 void vlc_join (vlc_thread_t th, void **result)
@@ -514,8 +506,6 @@ void vlc_testcancel (void)
         p->proc (p->data);
 
     th->data = NULL; /* TODO: special value? */
-    if (th->id == NULL) /* Detached thread */
-        vlc_thread_destroy(th);
 #if VLC_WINSTORE_APP
     ExitThread(0);
 #else // !VLC_WINSTORE_APP
-- 
2.26.2



More information about the vlc-devel mailing list