static DWORD CALLBACK profthr_func (LPVOID arg) { struct profinfo *p = (struct profinfo *) arg; u_long pc, idx; for (;;) { pc = (u_long) get_thrpc (p->targthr); if (pc >= p->lowpc && pc < p->highpc) { idx = PROFIDX (pc, p->lowpc, p->scale); p->counter[idx]++; } #if 0 print_prof (p); #endif Sleep (SLEEPTIME); } return 0; }
static void CALLBACK profthr_func (LPVOID arg) { struct profinfo *p = (struct profinfo *) arg; size_t pc, idx; for (;;) { pc = (size_t) get_thrpc (p->targthr); if (pc >= p->lowpc && pc < p->highpc) { idx = PROFIDX (pc, p->lowpc, p->scale); p->counter[idx]++; } #if 0 print_prof (p); #endif /* Check quit condition, WAIT_OBJECT_0 or WAIT_TIMEOUT */ if (WaitForSingleObject (p->quitevt, SLEEPTIME) == WAIT_OBJECT_0) return; } }