CCritSec Debug Functions

The Wxutil.h header file in the Microsoft® DirectShow® base classes provides functions to make deadlocks easier to track. It is useful to insert an assertion in the code that says whether a critical section is owned or not. The routines that do the checking are global functions to avoid having different numbers of member functions in the debug and retail class implementations of CCritSec. In addition, Wxutil.h provides a routine that enables you to trace usage of specific critical sections. Because of the large number of critical sections, this assertion defaults to off.

CritCheckIn Checks that the current thread is the owner of the given critical section.
CritCheckOut Checks that the current thread is not the owner of the given critical section.
DbgLockTrace Enables or disables debug logging of a given critical section.

CritCheckIn

CCritSec Debug Functions

Checks that the owner of pcCrit is the current thread.

Syntax

BOOL WINAPI CritCheckIn(

  CCritSec *pcCrit
  );

Parameters

pcCrit
Pointer to a CCritSec critical section.

Return Value

Returns TRUE if the current thread is the owner of this critical section, or FALSE otherwise.

Remarks

If you call this function when DEBUG is not defined and you've included the DirectShow headers, it will always return TRUE.

CritCheckOut

CCritSec Debug Functions

Checks that the owner of pcCrit is not the current thread.

Syntax

BOOL WINAPI CritCheckOut(

  CCritSec *pcCrit
  );

Parameters

pcCrit
Pointer to a CCritSec critical section.

Return Value

Returns TRUE if the current thread is not the owner of this critical section, or FALSE otherwise.

Remarks

If you call this function when DEBUG is not defined and you've included the DirectShow headers, it will always return TRUE.

DbgLockTrace

CCritSec Debug Functions

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. Set to TRUE to enable logging or FALSE to disable it.

Return Value

No return value.

Remarks

This function does nothing unless DEBUG is defined when the DirectShow headers are included.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.