Add static SetNameForCurrent for setting name of non-wxThreads
Co-authored-by: PB <PBforDev@gmail.com>
This commit is contained in:
@@ -596,6 +596,9 @@ public:
|
|||||||
// Delete() instead (or leave the thread terminate by itself)
|
// Delete() instead (or leave the thread terminate by itself)
|
||||||
virtual ~wxThread();
|
virtual ~wxThread();
|
||||||
|
|
||||||
|
// sets name to assist debugging
|
||||||
|
static bool SetNameForCurrent(const wxString &name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// sets name to assist debugging
|
// sets name to assist debugging
|
||||||
bool SetName(const wxString &name);
|
bool SetName(const wxString &name);
|
||||||
|
@@ -1407,6 +1407,18 @@ protected:
|
|||||||
@since 3.1.6
|
@since 3.1.6
|
||||||
*/
|
*/
|
||||||
bool SetName(const wxString &name);
|
bool SetName(const wxString &name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Sets an internal name for the current thread, which may be a wxThread
|
||||||
|
or any other kind of thread; e.g. an std::thread.
|
||||||
|
|
||||||
|
@return Either:
|
||||||
|
- @false: Failure or missing implementation for this OS.
|
||||||
|
- @true: Success or undetectable failure.
|
||||||
|
|
||||||
|
@since 3.1.6
|
||||||
|
*/
|
||||||
|
static bool SetNameForCurrent(const wxString &name);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1194,6 +1194,12 @@ bool wxThread::SetName(const wxString &name)
|
|||||||
wxCHECK_MSG(this == This(), false,
|
wxCHECK_MSG(this == This(), false,
|
||||||
"SetName() must be called in the context of the thread to be named");
|
"SetName() must be called in the context of the thread to be named");
|
||||||
|
|
||||||
|
return SetNameForCurrent(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
bool wxThread::SetNameForCurrent(const wxString &name)
|
||||||
|
{
|
||||||
bool retval = wxSetThreadNameOnWindows10(name.wc_str());
|
bool retval = wxSetThreadNameOnWindows10(name.wc_str());
|
||||||
|
|
||||||
// Even if the method above succeeded, we can set
|
// Even if the method above succeeded, we can set
|
||||||
|
@@ -1685,7 +1685,12 @@ bool wxThread::SetName(const wxString &name)
|
|||||||
wxCHECK_MSG(this == This(), false,
|
wxCHECK_MSG(this == This(), false,
|
||||||
"SetName() must be called from inside the thread to be named");
|
"SetName() must be called from inside the thread to be named");
|
||||||
|
|
||||||
|
return SetNameForCurrent(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
bool wxThread::SetNameForCurrent(const wxString &name)
|
||||||
|
{
|
||||||
// the API is nearly the same on different *nix, but not quite:
|
// the API is nearly the same on different *nix, but not quite:
|
||||||
|
|
||||||
#if defined(__DARWIN__)
|
#if defined(__DARWIN__)
|
||||||
|
Reference in New Issue
Block a user