[vlc-devel] [PATCH 3/4] win32: inline vlc_thread_self() internally

RĂ©mi Denis-Courmont remi at remlab.net
Mon Feb 17 21:56:08 CET 2020


---
 src/win32/thread.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 31c3324f76..e0539f9322 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -582,7 +582,7 @@ void vlc_cancel (vlc_thread_t th)
 
 int vlc_savecancel (void)
 {
-    struct vlc_thread *th = vlc_thread_self();
+    struct vlc_thread *th = TlsGetValue(thread_key);
     if (th == NULL)
         return false; /* Main thread - cannot be cancelled anyway */
 
@@ -593,7 +593,7 @@ int vlc_savecancel (void)
 
 void vlc_restorecancel (int state)
 {
-    struct vlc_thread *th = vlc_thread_self();
+    struct vlc_thread *th = TlsGetValue(thread_key);
     assert (state == false || state == true);
 
     if (th == NULL)
@@ -605,7 +605,7 @@ void vlc_restorecancel (int state)
 
 void vlc_testcancel (void)
 {
-    struct vlc_thread *th = vlc_thread_self();
+    struct vlc_thread *th = TlsGetValue(thread_key);
     if (th == NULL)
         return; /* Main thread - cannot be cancelled anyway */
     if (!th->killable)
@@ -629,7 +629,7 @@ void vlc_control_cancel (vlc_cleanup_t *cleaner)
     /* NOTE: This function only modifies thread-specific data, so there is no
      * need to lock anything. */
 
-    struct vlc_thread *th = vlc_thread_self();
+    struct vlc_thread *th = TlsGetValue(thread_key);
     if (th == NULL)
         return; /* Main thread - cannot be cancelled anyway */
 
@@ -648,7 +648,7 @@ void vlc_control_cancel (vlc_cleanup_t *cleaner)
 
 void vlc_cancel_addr_set(atomic_uint *addr)
 {
-    struct vlc_thread *th = vlc_thread_self();
+    struct vlc_thread *th = TlsGetValue(thread_key);
     if (th == NULL)
         return; /* Main thread - cannot be cancelled anyway */
 
@@ -660,7 +660,7 @@ void vlc_cancel_addr_set(atomic_uint *addr)
 
 void vlc_cancel_addr_clear(atomic_uint *addr)
 {
-    struct vlc_thread *th = vlc_thread_self();
+    struct vlc_thread *th = TlsGetValue(thread_key);
     if (th == NULL)
         return; /* Main thread - cannot be cancelled anyway */
 
-- 
2.25.0



More information about the vlc-devel mailing list