Table of Contents

Method RunWithTimeout

Namespace
Alternet.Common
Assembly
Alternet.Common.v10.dll

RunWithTimeout(Func<Task>, int)

Runs a task with a specified timeout.

public static Task<bool> RunWithTimeout(Func<Task> taskFunc, int timeoutMs)

Parameters

taskFunc Func<Task>

The asynchronous function to execute.

timeoutMs int

The timeout duration in milliseconds.

Returns

Task<bool>

true if the task completes within the timeout; otherwise, false.