OpenCV for Unity 3.0.4
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/5.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.Extensions.SourceToMat.SourceToMatSynchronizationContextScope Struct Reference

Temporarily restores a captured SynchronizationContext for the current async flow. More...

Public Member Functions

 SourceToMatSynchronizationContextScope (SynchronizationContext captured)
 Initializes a new instance of the SourceToMatSynchronizationContextScope struct.
 
void Dispose ()
 Restores SynchronizationContext.Current to the value from before this scope was created.
 

Detailed Description

Temporarily restores a captured SynchronizationContext for the current async flow.

Layer 2 (host loop). Wrap the full host-loop-dependent body of grabber Grabbers.IFrameGrabber.OpenAsync in this scope. Use SourceToMatHostMarshaling.ResolveCapturedSynchronizationContext for the captured argument.

Host-loop ticks via SourceToMatHostWait or SourceToMatHostMarshaling.YieldCapturedSynchronizationContextAsync run inside this scope (or a nested scope when an inner await may clear SynchronizationContext.Current).

When captured is null, the scope is a no-op (nothing is saved or restored). Prefer constructing grabbers on the host main thread so a non-null context is captured.

Always dispose (for example using) so SynchronizationContext.Current is restored. Nesting is supported: each scope saves and restores its own previous context.

Constructor & Destructor Documentation

◆ SourceToMatSynchronizationContextScope()

OpenCVForUnity.Extensions.SourceToMat.SourceToMatSynchronizationContextScope.SourceToMatSynchronizationContextScope ( SynchronizationContext captured)

Initializes a new instance of the SourceToMatSynchronizationContextScope struct.

Parameters
capturedSynchronization context captured on the main thread; null makes the scope a no-op.

Member Function Documentation

◆ Dispose()

void OpenCVForUnity.Extensions.SourceToMat.SourceToMatSynchronizationContextScope.Dispose ( )

Restores SynchronizationContext.Current to the value from before this scope was created.


The documentation for this struct was generated from the following file: