This commit is contained in:
Glenn Maynard
2003-09-03 03:30:32 +00:00
parent 77d4263752
commit 3f19c51f27
5 changed files with 10 additions and 11 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ void ThreadSlot::SetupThisThread()
#endif
#ifdef _WINDOWS
InitThreadData( name );
InitThreadData();
#endif
threadid = SDL_ThreadID();
+5 -5
View File
@@ -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);
+1 -2
View File
@@ -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);
+2 -2
View File
@@ -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() {
+1 -1
View File
@@ -25,7 +25,7 @@ struct VirtualDubTLSData {
extern __declspec(thread) VirtualDubTLSData g_tlsdata;
void InitThreadData(const char *pszName);
void InitThreadData();
void DeinitThreadData();
#endif