simplify
This commit is contained in:
@@ -171,7 +171,7 @@ void ThreadSlot::SetupThisThread()
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
InitThreadData( name );
|
||||
InitThreadData();
|
||||
#endif
|
||||
|
||||
threadid = SDL_ThreadID();
|
||||
|
||||
@@ -119,7 +119,7 @@ static CRITICAL_SECTION g_csPerThreadState;
|
||||
static List2<VirtualDubThreadStateNode> g_listPerThreadState;
|
||||
static LONG g_nThreadsTrackedMinusOne = -1;
|
||||
|
||||
void VirtualDubInitializeThread(const char *pszName) {
|
||||
void VirtualDubInitializeThread() {
|
||||
DWORD dwThreadId = GetCurrentThreadId();
|
||||
|
||||
if (!InterlockedIncrement(&g_nThreadsTrackedMinusOne)) {
|
||||
@@ -128,9 +128,9 @@ void VirtualDubInitializeThread(const char *pszName) {
|
||||
|
||||
EnterCriticalSection(&g_csPerThreadState);
|
||||
|
||||
if (DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), (HANDLE *)&g_PerThreadState.hThread, NULL, FALSE, DUPLICATE_SAME_ACCESS)) {
|
||||
|
||||
g_PerThreadState.pszThreadName = pszName;
|
||||
g_PerThreadState.hThread = NULL;
|
||||
if (DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), (HANDLE *)&g_PerThreadState.hThread, NULL, FALSE, DUPLICATE_SAME_ACCESS))
|
||||
{
|
||||
g_PerThreadState.dwThreadId = dwThreadId;
|
||||
|
||||
g_PerThreadStateNode.pState = &g_PerThreadState;
|
||||
@@ -147,7 +147,7 @@ void VirtualDubDeinitializeThread() {
|
||||
|
||||
LeaveCriticalSection(&g_csPerThreadState);
|
||||
|
||||
if (g_PerThreadState.pszThreadName)
|
||||
if (g_PerThreadState.hThread)
|
||||
CloseHandle((HANDLE)g_PerThreadState.hThread);
|
||||
|
||||
InterlockedDecrement(&g_nThreadsTrackedMinusOne);
|
||||
|
||||
@@ -27,14 +27,13 @@
|
||||
#define CHECKPOINT_COUNT (2)
|
||||
|
||||
struct VirtualDubThreadState {
|
||||
const char *pszThreadName;
|
||||
unsigned long dwThreadId;
|
||||
void * hThread;
|
||||
};
|
||||
|
||||
EXTERN __declspec(thread) VirtualDubThreadState g_PerThreadState;
|
||||
|
||||
void VirtualDubInitializeThread(const char *pszName);
|
||||
void VirtualDubInitializeThread();
|
||||
void VirtualDubDeinitializeThread();
|
||||
extern long __stdcall CrashHandler(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
__declspec(thread) VirtualDubTLSData g_tlsdata;
|
||||
|
||||
void InitThreadData(const char *pszName) {
|
||||
void InitThreadData() {
|
||||
VirtualDubTLSData *pData = &g_tlsdata;
|
||||
|
||||
__asm {
|
||||
@@ -29,7 +29,7 @@ void InitThreadData(const char *pszName) {
|
||||
mov dword ptr fs:[14h],eax
|
||||
}
|
||||
|
||||
VirtualDubInitializeThread(pszName);
|
||||
VirtualDubInitializeThread();
|
||||
}
|
||||
|
||||
void DeinitThreadData() {
|
||||
|
||||
@@ -25,7 +25,7 @@ struct VirtualDubTLSData {
|
||||
|
||||
extern __declspec(thread) VirtualDubTLSData g_tlsdata;
|
||||
|
||||
void InitThreadData(const char *pszName);
|
||||
void InitThreadData();
|
||||
void DeinitThreadData();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user