From b8532df921d44bb59d651cb00439dcd7050e5601 Mon Sep 17 00:00:00 2001 From: janwas Date: Wed, 11 May 2005 04:35:21 +0000 Subject: [PATCH] wcpu: improve comments and fix CONTEXT bug in profiler win_internal(+wtime): better names for critical sections (now name of file) This was SVN commit r2279. --- source/lib/sysdep/win/wcpu.cpp | 5 +++-- source/lib/sysdep/win/win_internal.h | 4 ++-- source/lib/sysdep/win/wtime.cpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/lib/sysdep/win/wcpu.cpp b/source/lib/sysdep/win/wcpu.cpp index 3653971b70..d40b0ca859 100755 --- a/source/lib/sysdep/win/wcpu.cpp +++ b/source/lib/sysdep/win/wcpu.cpp @@ -216,7 +216,7 @@ static uintptr_t get_target_pc() ret = SuspendThread(hThread); if(ret == (DWORD)-1) { - debug_warn("SuspendThread failed"); + debug_warn("get_target_pc: SuspendThread failed"); return -1; } // note: we don't need to call more than once: this increments a DWORD @@ -227,13 +227,14 @@ static uintptr_t get_target_pc() // be VERY CAREFUL to avoid anything that may acquire a lock until // after ResumeThread! this includes locks taken by the OS, - // e.g. malloc -> heap or GetProcAddres -> loader. + // e.g. malloc -> heap or GetProcAddress -> loader. // reason is, if the target thread was holding a lock we try to // acquire here, a classic deadlock results. uintptr_t pc = 0; // => will return 0 if GetThreadContext fails CONTEXT context; + context.ContextFlags = CONTEXT_CONTROL; if(GetThreadContext(hThread, &context)) { #if defined(_M_AMD64) diff --git a/source/lib/sysdep/win/win_internal.h b/source/lib/sysdep/win/win_internal.h index ad7c19a0d3..77adccbab6 100755 --- a/source/lib/sysdep/win/win_internal.h +++ b/source/lib/sysdep/win/win_internal.h @@ -361,10 +361,10 @@ extern int main(int, char*[]); enum { ONCE_CS, - HRT_CS, + WTIME_CS, WAIO_CS, WIN_CS, - DBGHELP_CS, + WDBG_CS, NUM_CS }; diff --git a/source/lib/sysdep/win/wtime.cpp b/source/lib/sysdep/win/wtime.cpp index 1f3bad15bd..7d2269e281 100755 --- a/source/lib/sysdep/win/wtime.cpp +++ b/source/lib/sysdep/win/wtime.cpp @@ -142,11 +142,11 @@ static const i64 _1e9 = 1000000000; static inline void lock(void) { - win_lock(HRT_CS); + win_lock(WTIME_CS); } static inline void unlock(void) { - win_unlock(HRT_CS); + win_unlock(WTIME_CS); }