diff --git a/common/include/Utilities/PersistentThread.h b/common/include/Utilities/PersistentThread.h index cb2235bf8f..d0ee1ba639 100644 --- a/common/include/Utilities/PersistentThread.h +++ b/common/include/Utilities/PersistentThread.h @@ -58,6 +58,9 @@ protected: virtual void OnThreadCleanup() = 0; }; +/// Set the name of the current thread +void SetNameOfCurrentThread(const char* name); + // -------------------------------------------------------------------------------------- // pxThread - Helper class for the basics of starting/managing persistent threads. // -------------------------------------------------------------------------------------- @@ -194,7 +197,7 @@ protected: bool _basecancel(); void _selfRunningTest(const wxChar *name) const; void _DoSetThreadName(const wxString &name); - void _DoSetThreadName(const char *name); + void _DoSetThreadName(const char *name) { SetNameOfCurrentThread(name); } void _internal_execute(); void _try_virtual_invoke(void (pxThread::*method)()); void _ThreadCleanup(); diff --git a/common/src/Utilities/Darwin/DarwinThreads.cpp b/common/src/Utilities/Darwin/DarwinThreads.cpp index b769d3543d..803571da57 100644 --- a/common/src/Utilities/Darwin/DarwinThreads.cpp +++ b/common/src/Utilities/Darwin/DarwinThreads.cpp @@ -126,7 +126,7 @@ void Threading::pxThread::_platform_specific_OnCleanupInThread() } // name can be up to 16 bytes -void Threading::pxThread::_DoSetThreadName(const char *name) +void Threading::SetNameOfCurrentThread(const char *name) { pthread_setname_np(name); } diff --git a/common/src/Utilities/Linux/LnxThreads.cpp b/common/src/Utilities/Linux/LnxThreads.cpp index fe7e24cbcb..c2f8ddf7e1 100644 --- a/common/src/Utilities/Linux/LnxThreads.cpp +++ b/common/src/Utilities/Linux/LnxThreads.cpp @@ -118,7 +118,7 @@ void Threading::pxThread::_platform_specific_OnCleanupInThread() // Cleanup handles here, which were opened above. } -void Threading::pxThread::_DoSetThreadName(const char *name) +void Threading::SetNameOfCurrentThread(const char *name) { #if defined(__linux__) // Extract of manpage: "The name can be up to 16 bytes long, and should be diff --git a/common/src/Utilities/Windows/WinThreads.cpp b/common/src/Utilities/Windows/WinThreads.cpp index 5e63d5375e..19219a176e 100644 --- a/common/src/Utilities/Windows/WinThreads.cpp +++ b/common/src/Utilities/Windows/WinThreads.cpp @@ -103,7 +103,7 @@ void Threading::pxThread::_platform_specific_OnCleanupInThread() CloseHandle((HANDLE)m_native_handle); } -void Threading::pxThread::_DoSetThreadName(const char *name) +void Threading::SetNameOfCurrentThread(const char *name) { // This feature needs Windows headers and MSVC's SEH support: