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.InitTimeoutBudget Class Referencesealed

Shared initialization timeout budget for Grabbers.IFrameGrabber.OpenAsync and first-frame wait. Time spent inside RunOutsideTimeoutAsync does not consume the budget (for example long-running host prompts such as OS permission dialogs). A timeout of zero or less means unlimited. More...

Public Member Functions

void Dispose ()
 Stops the budget stopwatch and marks this instance disposed.
 
async Task RunOutsideTimeoutAsync (Func< CancellationToken, Task > action, CancellationToken cancellationToken)
 Runs action without consuming the timeout budget. User cancellation is still honored via cancellationToken . Nested calls are not supported.
 
async Task< T > RunOutsideTimeoutAsync< T > (Func< CancellationToken, Task< T > > action, CancellationToken cancellationToken)
 Runs action without consuming the timeout budget and returns its result. User cancellation is still honored via cancellationToken . Nested calls are not supported.
 

Static Public Member Functions

static InitTimeoutBudget FromMilliseconds (int timeoutMs, CancellationToken cancellationToken=default)
 Creates a budget with the specified total timeout in milliseconds. A value less than or equal to zero means no timeout (unlimited).
 

Properties

bool IsExpired [get]
 Gets whether the Open / first-frame wall-clock budget has been exhausted. Always false when the timeout is unlimited. This is the only timeout signal; Token is not canceled when the budget expires.
 
int RemainingMilliseconds [get]
 Gets the remaining budget in milliseconds, or int.MaxValue when unlimited.
 
CancellationToken Token [get]
 Gets the cooperative user cancellation token passed to FromMilliseconds. This token is not canceled when the wall-clock budget is exhausted; use IsExpired as the Open / first-frame deadline. Do not use this token as a timeout signal.
 

Detailed Description

Shared initialization timeout budget for Grabbers.IFrameGrabber.OpenAsync and first-frame wait. Time spent inside RunOutsideTimeoutAsync does not consume the budget (for example long-running host prompts such as OS permission dialogs). A timeout of zero or less means unlimited.

Member Function Documentation

◆ Dispose()

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

Stops the budget stopwatch and marks this instance disposed.

◆ FromMilliseconds()

static InitTimeoutBudget OpenCVForUnity.Extensions.SourceToMat.InitTimeoutBudget.FromMilliseconds ( int timeoutMs,
CancellationToken cancellationToken = default )
static

Creates a budget with the specified total timeout in milliseconds. A value less than or equal to zero means no timeout (unlimited).

Parameters
timeoutMsTotal shared budget in milliseconds for open and first-frame wait.
cancellationTokenUser cancellation token exposed as Token.
Returns
A new InitTimeoutBudget instance.

◆ RunOutsideTimeoutAsync()

async Task OpenCVForUnity.Extensions.SourceToMat.InitTimeoutBudget.RunOutsideTimeoutAsync ( Func< CancellationToken, Task > action,
CancellationToken cancellationToken )

Runs action without consuming the timeout budget. User cancellation is still honored via cancellationToken . Nested calls are not supported.

Do not use ConfigureAwait(false) on the inner await. Callers that depend on SynchronizationContext marshaling must resume on the same context after action completes (including after long-running host work such as OS permission prompts). Deadline checks remain IsExpired (the stopwatch is paused); Token is not canceled by elapsed time.

Parameters
actionThe asynchronous work to run outside the timeout budget.
cancellationTokenCancellation token for the outside work (typically the user token).
Returns
A task that completes when action completes.

◆ RunOutsideTimeoutAsync< T >()

async Task< T > OpenCVForUnity.Extensions.SourceToMat.InitTimeoutBudget.RunOutsideTimeoutAsync< T > ( Func< CancellationToken, Task< T > > action,
CancellationToken cancellationToken )

Runs action without consuming the timeout budget and returns its result. User cancellation is still honored via cancellationToken . Nested calls are not supported.

Do not use ConfigureAwait(false) on the inner await. Callers that depend on SynchronizationContext marshaling must resume on the same context after action completes (including after long-running host work such as OS permission prompts). Deadline checks remain IsExpired (the stopwatch is paused); Token is not canceled by elapsed time.

Template Parameters
TThe result type of action .
Parameters
actionThe asynchronous work to run outside the timeout budget.
cancellationTokenCancellation token for the outside work (typically the user token).
Returns
A task that produces the result of action .

Property Documentation

◆ IsExpired

bool OpenCVForUnity.Extensions.SourceToMat.InitTimeoutBudget.IsExpired
get

Gets whether the Open / first-frame wall-clock budget has been exhausted. Always false when the timeout is unlimited. This is the only timeout signal; Token is not canceled when the budget expires.

◆ RemainingMilliseconds

int OpenCVForUnity.Extensions.SourceToMat.InitTimeoutBudget.RemainingMilliseconds
get

Gets the remaining budget in milliseconds, or int.MaxValue when unlimited.

◆ Token

CancellationToken OpenCVForUnity.Extensions.SourceToMat.InitTimeoutBudget.Token
get

Gets the cooperative user cancellation token passed to FromMilliseconds. This token is not canceled when the wall-clock budget is exhausted; use IsExpired as the Open / first-frame deadline. Do not use this token as a timeout signal.


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