mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-09-20 03:27:16 +02:00
win32pthreads: Changed from _beginthreadex to CreateThread, which is the preferred method of creating threads when using dynamic CRT linking.
PCSX2/Win32: * Assigned names to the threads so that they show up nicely in the debugger. * Added more error checking in the new stdout/stderr PipeRedirection code, hopefully fixing Issue 422 (but can't reproduce the error here to be sure). git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1904 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
@@ -203,6 +203,39 @@ namespace Threading
|
||||
|
||||
return (void*)owner.m_returncode;
|
||||
}
|
||||
|
||||
void PersistentThread::SetName( __unused const char* name )
|
||||
{
|
||||
wxASSERT( IsSelf() ); // only allowed from our own thread, thanks.
|
||||
|
||||
#ifdef _WINDOWS_
|
||||
static const int MS_VC_EXCEPTION = 0x406D1388;
|
||||
|
||||
#pragma pack(push,8)
|
||||
struct THREADNAME_INFO
|
||||
{
|
||||
DWORD dwType; // Must be 0x1000.
|
||||
LPCSTR szName; // Pointer to name (in user addr space).
|
||||
DWORD dwThreadID; // Thread ID (-1=caller thread).
|
||||
DWORD dwFlags; // Reserved for future use, must be zero.
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
THREADNAME_INFO info;
|
||||
info.dwType = 0x1000;
|
||||
info.szName = name;
|
||||
info.dwThreadID = GetCurrentThreadId();
|
||||
info.dwFlags = 0;
|
||||
|
||||
__try
|
||||
{
|
||||
RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info );
|
||||
}
|
||||
__except(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// BaseTaskThread Implementations
|
||||
|
||||
Reference in New Issue
Block a user