TaskExtensions
Represents extension methods for common task operations.
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace Relativity.DataExchange
{
public static class TaskExtensions
{
[AsyncStateMachine(typeof(<WithTimeout>d__0))]
public static Task WithTimeout(this Task source, TimeSpan timeout, string operation)
{
<WithTimeout>d__0 stateMachine = default(<WithTimeout>d__0);
stateMachine.<>t__builder = AsyncTaskMethodBuilder.Create();
stateMachine.source = source;
stateMachine.timeout = timeout;
stateMachine.operation = operation;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
[AsyncStateMachine(typeof(<WithTimeout>d__1<>))]
public static Task<TResult> WithTimeout<TResult>(this Task<TResult> source, TimeSpan timeout, string operation)
{
<WithTimeout>d__1<TResult> stateMachine = default(<WithTimeout>d__1<TResult>);
stateMachine.<>t__builder = AsyncTaskMethodBuilder<TResult>.Create();
stateMachine.source = source;
stateMachine.timeout = timeout;
stateMachine.operation = operation;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
return stateMachine.<>t__builder.Task;
}
}
}