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