Add wxThread::SetName for naming threads for debugging purposes
Such thread names can be shown by some debuggers, and depending on the OS and compiler versions used, they can be visible in process lists and crash dumps. Co-authored-by: PB <PBforDev@gmail.com>
This commit is contained in:
@@ -919,6 +919,10 @@ MyThread::~MyThread()
|
||||
|
||||
wxThread::ExitCode MyThread::Entry()
|
||||
{
|
||||
// setting thread name helps with debugging, as the debugger
|
||||
// may be able to show thread names along with the list of threads.
|
||||
SetName("My Thread");
|
||||
|
||||
wxLogMessage("Thread started (priority = %u).", GetPriority());
|
||||
|
||||
for ( m_count = 0; m_count < 10; m_count++ )
|
||||
@@ -970,6 +974,10 @@ void MyWorkerThread::OnExit()
|
||||
|
||||
wxThread::ExitCode MyWorkerThread::Entry()
|
||||
{
|
||||
// setting thread name helps with debugging, as the debugger
|
||||
// may be able to show thread names along with the list of threads.
|
||||
SetName("Worker Thread");
|
||||
|
||||
#if TEST_YIELD_RACE_CONDITION
|
||||
if ( TestDestroy() )
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user