VC_SynchronizeExecution

BOOLEAN
VC_SynchronizeExecution(
    PDEVICE_INFO
pDevInfo,
    PSYNC_ROUTINE
pSync,
    PVOID
pContext
);

The VC_SynchronizeExecution function synchronizes access to objects that are referenced by a kernel-mode video capture driver’s InterruptAcknowledge function.

Parameters
pDevInfo
Pointer to the DEVICE_INFO structure returned by VC_Init.
pSync
Pointer to a callback function. The callback function must use the following prototype format:
BOOLEAN pSync(PVOID pContext);
pContext
Pointer to context information to be passed to the callback function.
Return Value

Returns the callback function’s return value.

Comments

A driver’s InterruptAcknowledge function executes at a device IRQL (DIRQL). If other code within the driver must access the same objects (generally, device registers) that the InterruptAcknowledge function references, then all code that references the objects, except the code within InterruptAcknowledge, must be synchronized by using VC_SynchronizeExecution.

To use VC_SynchronizeExecution, place each piece of code that references the objects to be protected into a callback function. Specify each callback function as a pSync parameter to a VC_SynchronizeExecution call. Typically, you use the pContext parameter to indicate the objects to be referenced.

The VC_SynchronizeExecution function calls the system’s KeSynchronizeExecution function to acquire a spin lock and execute the callback function at the same DIRQL that the InterruptAcknowledge function uses. If you access an object only within InterruptAcknowledge or within code that is included in VC_SynchronizeExecution callbacks, then other processors cannot simultaneously access the object, and lower-priority code on the current processor cannot obtain access.

Code that calls VC_SynchronizeExecution must be executing at the device’s DIRQL or lower. A driver’s CaptureService function, which executes at an IRQL of DISPATCH_LEVEL, can call VC_SynchronizeExecution.

The driver’s InterruptAcknowledge function should not call VC_SynchronizeExecution, because the Windows NT I/O Manager handles its synchronization.

See Also

VC_SynchronizeDPC