DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="3.3.1" />

 Synchronization

public static class Synchronization
Represents task synchronization and combination methods.
public static Result<TResult> GetResult<TResult>(this Task<TResult> task, TimeSpan timeout)

Gets task result synchronously.

public static Result<TResult> GetResult<TResult>(this Task<TResult> task, CancellationToken token)

Gets task result synchronously.

public static Result<object> GetResult(this Task task, CancellationToken token)

Gets task result synchronously.

public static Result<object> GetResult(this Task task, TimeSpan timeout)

Gets task result synchronously.

public static Task<bool> WaitAsync(this Task task, TimeSpan timeout, CancellationToken token = default)

Waits for task completion asynchronously.

public static Task<ValueTuple<T1, T2>> WhenAll<T1, T2>(Task<T1> task1, Task<T2> task2)

Creates a task that will complete when all of the passed tasks have completed.

public static Task<ValueTuple<T1, T2, T3>> WhenAll<T1, T2, T3>(Task<T1> task1, Task<T2> task2, Task<T3> task3)

Creates a task that will complete when all of the passed tasks have completed.

public static Task<ValueTuple<T1, T2, T3, T4>> WhenAll<T1, T2, T3, T4>(Task<T1> task1, Task<T2> task2, Task<T3> task3, Task<T4> task4)

Creates a task that will complete when all of the passed tasks have completed.

public static Task<ValueTuple<T1, T2, T3, T4, T5>> WhenAll<T1, T2, T3, T4, T5>(Task<T1> task1, Task<T2> task2, Task<T3> task3, Task<T4> task4, Task<T5> task5)

Creates a task that will complete when all of the passed tasks have completed.