|
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.
|
Shared wait loop for SourceToMat initialization and first-frame waits. More...
Static Public Member Functions | |
| static async Task< bool > | WaitUntilAsync (Func< bool > predicate, InitTimeoutBudget budget, CancellationToken userToken, Func< CancellationToken, Task > yieldOneTickAsync) |
Waits until predicate is true, the budget expires, or userToken is canceled. | |
Shared wait loop for SourceToMat initialization and first-frame waits.
Timeout is InitTimeoutBudget.IsExpired (stopwatch / wall-clock remaining budget). Do not use InitTimeoutBudget.Token as the loop condition, as a CancellationToken.Register timeout, or as the only CancellationToken.ThrowIfCancellationRequested deadline. InitTimeoutBudget.Token is cooperative user cancellation only. On some single-threaded hosts, time-based token cancellation such as CancellationTokenSource.CancelAfter does not fire, so a loop that waits only on that token never ends.
Loop contract:
false, throw if the user token is canceled, return true when the predicate is true, otherwise await one tick. false when the budget expires before the predicate becomes true (timeout). The caller supplies yieldOneTickAsync: one scheduling step per loop iteration. Host integrations that must pump the main message loop should inject a tick that advances that loop. Callers already on a compatible SynchronizationContext may pass a delegate that awaits Task.Yield. Do not use Task.Delay (including a delay of zero) as the tick.
|
static |
Waits until predicate is true, the budget expires, or userToken is canceled.
| 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. |
| yieldOneTickAsync | Awaits one scheduling tick per loop iteration. The host integration chooses whether that tick advances the main message loop or yields to the current SynchronizationContext (for example via Task.Yield). Must not be null. |
true when predicate became true; false when InitTimeoutBudget.IsExpired became true. | ArgumentNullException | Thrown when predicate , budget , or yieldOneTickAsync is null. |
| OperationCanceledException | Thrown when userToken is canceled. |