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.
This commit is contained in:
parent
5cd7997d16
commit
b8532df921
@ -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)
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user