// ks.h
BOOLEAN KsGateCaptureThreshold(
[in] PKSGATE Gate
);
View the official Windows Driver Kit DDI referenceNo description available.
The KsGateCaptureThreshold function is used to capture an ON input of an AND gate specified by Gate.
Gate [in]A pointer to a KSGATE structure representing the AND gate for which to capture an ON input synchronously.
KsGateCaptureThreshold returns TRUE if the AND gate was originally open. Note that returning TRUE implies that the gate was closed so that no other thread could simultaneously capture the gate and commence processing.
KsGateCaptureThreshold checks the state of the given AND gate. If the gate is open, it turns off an input to the gate, thereby transitioning the gate to a closed state. If the gate is closed, the function does nothing. Unlike KsGateGetStateUnsafe, this call is done synchronously with respect to other gate state changes. It is the primary synchronization mechanism for processing based on gate control.
Despite its name, this function is only a valid call for AND gates, not gates in general. AVStream, however, does not verify whether Gate is an AND gate or an OR gate. It is the caller's responsibility to ensure that the call is only made on AND gates.
The call is made using interlocked functions and is thus synchronous with respect to any of the other gate state change functions; it is also a very efficient method of process control.