summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-07 02:44:00 +0100
committerDudemanguy <random342@airmail.cc>2023-11-08 04:32:10 +0000
commit2ae56e78dd00bae6cd3078b574e2a2bb31962019 (patch)
treeff078b7f186533ed5d551adc242b8dad67b06a03 /osdep
parentadd2f3c8c9e0df97f426faa9694249ba30b87b0b (diff)
downloadmpv-2ae56e78dd00bae6cd3078b574e2a2bb31962019.tar.bz2
mpv-2ae56e78dd00bae6cd3078b574e2a2bb31962019.tar.xz
threads-win32: support UWP in mp_thread_set_name
Diffstat (limited to 'osdep')
-rw-r--r--osdep/threads-win32.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/osdep/threads-win32.h b/osdep/threads-win32.h
index 2617bcb51b..bfd17095ae 100644
--- a/osdep/threads-win32.h
+++ b/osdep/threads-win32.h
@@ -198,18 +198,22 @@ static inline int mp_thread_detach(mp_thread thread)
wchar_t *mp_from_utf8(void *talloc_ctx, const char *s);
static inline void mp_thread_set_name(const char *name)
{
+ HRESULT (WINAPI *pSetThreadDescription)(HANDLE, PCWSTR);
#if !HAVE_UWP
HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
if (!kernel32)
return;
- HRESULT (WINAPI *pSetThreadDescription)(HANDLE, PCWSTR) =
- (void *) GetProcAddress(kernel32, "SetThreadDescription");
+ pSetThreadDescription = (void *) GetProcAddress(kernel32, "SetThreadDescription");
if (!pSetThreadDescription)
return;
+#else
+ WINBASEAPI HRESULT WINAPI
+ SetThreadDescription(HANDLE hThread, PCWSTR lpThreadDescription);
+ pSetThreadDescription = &SetThreadDescription;
+#endif
wchar_t *wname = mp_from_utf8(NULL, name);
pSetThreadDescription(GetCurrentThread(), wname);
talloc_free(wname);
-#endif
}
static inline int64_t mp_thread_cpu_time_ns(mp_thread_id thread)