|
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.
|
Host message-loop wait loop for SourceToMat grabber Open waits. More...
Static Public Member Functions | |
| static Task< bool > | WaitUntilOnHostLoopAsync (Func< bool > predicate, InitTimeoutBudget budget, CancellationToken userToken, SynchronizationContext hostLoopContext) |
Waits until predicate is true, pumping the host message loop each tick. | |
| static async Task | YieldHostLoopTickAsync (SynchronizationContext hostLoopContext, CancellationToken userToken) |
| Yields one host-loop tick under SourceToMatSynchronizationContextScope. | |
Host message-loop wait loop for SourceToMat grabber Open waits.
Host-loop implementation of the wait loop contract in SourceToMatWait (timeout is InitTimeoutBudget.IsExpired; user CancellationToken is cooperative cancellation only). Do not use InitTimeoutBudget.Token as a timeout signal.
Each tick restores the captured SynchronizationContext with SourceToMatSynchronizationContextScope and then calls SourceToMatHostMarshaling.YieldCapturedSynchronizationContextAsync. Nested scopes are supported, so WaitUntilOnHostLoopAsync may be called from inside an Open SourceToMatSynchronizationContextScope.
Prefer WaitUntilOnHostLoopAsync over a hand-written while around SourceToMatHostMarshaling.YieldCapturedSynchronizationContextAsync.
Event-based waits may use TaskCompletionSource<TResult> and CancellationToken.Register on the user token. Drive the outer wait with WaitUntilOnHostLoopAsync on tcs.Task.IsCompleted. When the budget expires, call TrySetCanceled on the source; do not rely on CancelAfter to unblock the wait.
|
static |
Waits until predicate is true, pumping the host message loop each tick.
| predicate | Returns true when the wait should complete. Must not be null. |
| budget | Shared initialization timeout budget. Must not be null. |
| userToken | Cooperative user cancellation token. Not a timeout signal. |
| hostLoopContext | Captured SynchronizationContext from SourceToMatHostMarshaling.ResolveCapturedSynchronizationContext; may be null. |
true when predicate became true; false when InitTimeoutBudget.IsExpired became true. | ArgumentNullException | Thrown when predicate or budget is null. |
| OperationCanceledException | Thrown when userToken is canceled. |
|
static |
Yields one host-loop tick under SourceToMatSynchronizationContextScope.
Used by WaitUntilOnHostLoopAsync. Call directly only when a single host-loop tick is required (for example to resume the loop after ConfigureAwait(false)) and a predicate wait is not appropriate. Polling loops should use WaitUntilOnHostLoopAsync.
| hostLoopContext | Captured SynchronizationContext for the yield; may be null. |
| userToken | Cooperative user cancellation token. |