Microsoft DirectX 9.0 |
Enables or disables debug logging of a given critical section.
Syntax
void WINAPI DbgLockTrace(
CCritSec *pcCrit,
BOOL fTrace
);
Parameters
pcCrit
Pointer to a CCritSec critical section.
fTrace
Value specifying whether logging is enabled. Use TRUE to enable logging or FALSE to disable it.
Remarks
Use this function to trace a specific critical section. By default, debug logging of critical sections is disabled, because of the large number of critical sections.
To trace a critical section, perform the following steps:
In retail builds, the DbgLockTrace function has no effect.
Example Code
The following code example shows how to trace a critical section:
DbgInitialise(g_hInst);
DbgSetModuleLevel(LOG_LOCKING, 3);
{
CCritSec MyLock;
DbgLockTrace(&MyLock, TRUE);
CAutoLock cObjectLock(&MyLock);
// Protected section of code.
DbgOutString("This code is inside a critical section.\n");
} // Lock goes out of scope here.
DbgTerminate();
The debug output will look similar to the following:
Example.exe(tid 360) 2012 : Thread 864 now owns lock 12fc2c
This code is inside a critical section.
Example.exe(tid 360) 4887 : Thread 864 releasing lock 12fc2c
See Also