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:
Jake.Stine
2009-09-22 17:28:48 +00:00
parent 0fe6bd16f3
commit 39bd850f72
7 changed files with 56 additions and 7 deletions
+33
View File
@@ -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