aboutsummaryrefslogtreecommitdiff
path: root/src/platform/w32functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/w32functions.c')
-rw-r--r--src/platform/w32functions.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/platform/w32functions.c b/src/platform/w32functions.c
index 0feafa5b..4b1e2c1c 100644
--- a/src/platform/w32functions.c
+++ b/src/platform/w32functions.c
@@ -667,39 +667,3 @@ int W32_snprintf(char *__restrict s, size_t n, const char *__restrict format, ..
667 667
668 return ret; 668 return ret;
669} 669}
670
671#ifdef _MSC_FULL_VER
672/**
673 * Set thread name
674 * @param thread_id ID of thread, -1 for current thread
675 * @param thread_name name to set
676 */
677void W32_SetThreadName(const DWORD thread_id, const char *thread_name)
678{
679 static const DWORD VC_SETNAME_EXC = 0x406D1388;
680#pragma pack(push,8)
681 struct thread_info_struct
682 {
683 DWORD type; /* Must be 0x1000. */
684 LPCSTR name; /* Pointer to name (in user address space). */
685 DWORD ID; /* Thread ID (-1=caller thread). */
686 DWORD flags; /* Reserved for future use, must be zero. */
687 } thread_info;
688#pragma pack(pop)
689
690 if (NULL == thread_name)
691 return;
692
693 thread_info.type = 0x1000;
694 thread_info.name = thread_name;
695 thread_info.ID = thread_id;
696 thread_info.flags = 0;
697
698 __try
699 { /* This exception is intercepted by debugger */
700 RaiseException(VC_SETNAME_EXC, 0, sizeof(thread_info) / sizeof(ULONG_PTR), (ULONG_PTR*)&thread_info);
701 }
702 __except (EXCEPTION_EXECUTE_HANDLER)
703 {}
704}
705#endif /* _MSC_FULL_VER */