Class ValueTaskSynchronization
Provides a set of methods for synchronization and combination of multiple 
Namespace: DotNext.Threading.Tasks
Assembly: DotNext.Threading.dll
Syntax
public static class ValueTaskSynchronization : object
  Remarks
Methods in this class exist for architectural symmetry with WhenAll and WhenAny methods
from 
Methods
| Improve this Doc View SourceWhenAll(ValueTask, ValueTask)
Creates a task that will complete when all of the passed tasks have completed.
Declaration
public static ValueTask WhenAll(ValueTask task1, ValueTask task2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask | task1 | The first task to await.  | 
      
| ValueTask | task2 | The second task to await.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask | A task that represents the completion of all of the supplied tasks.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAll(ValueTask, ValueTask, ValueTask)
Creates a task that will complete when all of the passed tasks have completed.
Declaration
public static ValueTask WhenAll(ValueTask task1, ValueTask task2, ValueTask task3)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask | task1 | The first task to await.  | 
      
| ValueTask | task2 | The second task to await.  | 
      
| ValueTask | task3 | The third task to await.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask | A task that represents the completion of all of the supplied tasks.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAll(ValueTask, ValueTask, ValueTask, ValueTask)
Creates a task that will complete when all of the passed tasks have completed.
Declaration
public static ValueTask WhenAll(ValueTask task1, ValueTask task2, ValueTask task3, ValueTask task4)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask | task1 | The first task to await.  | 
      
| ValueTask | task2 | The second task to await.  | 
      
| ValueTask | task3 | The third task to await.  | 
      
| ValueTask | task4 | The fourth task to await.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask | A task that represents the completion of all of the supplied tasks.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAll(ValueTask, ValueTask, ValueTask, ValueTask, ValueTask)
Creates a task that will complete when all of the passed tasks have completed.
Declaration
public static ValueTask WhenAll(ValueTask task1, ValueTask task2, ValueTask task3, ValueTask task4, ValueTask task5)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask | task1 | The first task to await.  | 
      
| ValueTask | task2 | The second task to await.  | 
      
| ValueTask | task3 | The third task to await.  | 
      
| ValueTask | task4 | The third task to await.  | 
      
| ValueTask | task5 | The fifth task to await.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask | A task that represents the completion of all of the supplied tasks.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAll<T1, T2>(ValueTask<T1>, ValueTask<T2>)
Creates a task that will complete when all of the passed tasks have completed.
Declaration
public static ValueTask<(T1, T2)> WhenAll<T1, T2>(ValueTask<T1> task1, ValueTask<T2> task2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask<T1> | task1 | The first task to await.  | 
      
| ValueTask<T2> | task2 | The second task to await.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTuple<T1, T2>> | A task containing results of both tasks.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T1 | The type of the first task.  | 
      
| T2 | The type of the second task.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAll<T1, T2, T3>(ValueTask<T1>, ValueTask<T2>, ValueTask<T3>)
Creates a task that will complete when all of the passed tasks have completed.
Declaration
public static ValueTask<(T1, T2, T3)> WhenAll<T1, T2, T3>(ValueTask<T1> task1, ValueTask<T2> task2, ValueTask<T3> task3)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask<T1> | task1 | The first task to await.  | 
      
| ValueTask<T2> | task2 | The second task to await.  | 
      
| ValueTask<T3> | task3 | The third task to await.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTuple<T1, T2, T3>> | A task containing results of all tasks.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T1 | The type of the first task.  | 
      
| T2 | The type of the second task.  | 
      
| T3 | The type of the third task.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAll<T1, T2, T3, T4>(ValueTask<T1>, ValueTask<T2>, ValueTask<T3>, ValueTask<T4>)
Creates a task that will complete when all of the passed tasks have completed.
Declaration
public static ValueTask<(T1, T2, T3, T4)> WhenAll<T1, T2, T3, T4>(ValueTask<T1> task1, ValueTask<T2> task2, ValueTask<T3> task3, ValueTask<T4> task4)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask<T1> | task1 | The first task to await.  | 
      
| ValueTask<T2> | task2 | The second task to await.  | 
      
| ValueTask<T3> | task3 | The third task to await.  | 
      
| ValueTask<T4> | task4 | The fourth task to await.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTuple<T1, T2, T3, T4>> | A task containing results of all tasks.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T1 | The type of the first task.  | 
      
| T2 | The type of the second task.  | 
      
| T3 | The type of the third task.  | 
      
| T4 | The type of the fourth task.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAll<T1, T2, T3, T4, T5>(ValueTask<T1>, ValueTask<T2>, ValueTask<T3>, ValueTask<T4>, ValueTask<T5>)
Creates a task that will complete when all of the passed tasks have completed.
Declaration
public static ValueTask<(T1, T2, T3, T4, T5)> WhenAll<T1, T2, T3, T4, T5>(ValueTask<T1> task1, ValueTask<T2> task2, ValueTask<T3> task3, ValueTask<T4> task4, ValueTask<T5> task5)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask<T1> | task1 | The first task to await.  | 
      
| ValueTask<T2> | task2 | The second task to await.  | 
      
| ValueTask<T3> | task3 | The third task to await.  | 
      
| ValueTask<T4> | task4 | The fourth task to await.  | 
      
| ValueTask<T5> | task5 | The fifth task to await.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTuple<T1, T2, T3, T4, T5>> | A task containing results of all tasks.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T1 | The type of the first task.  | 
      
| T2 | The type of the second task.  | 
      
| T3 | The type of the third task.  | 
      
| T4 | The type of the fourth task.  | 
      
| T5 | The type of the fifth task.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAny(ValueTask, ValueTask)
Creates a task that will complete when any of the supplied tasks have completed.
Declaration
public static ValueTask<ValueTask> WhenAny(ValueTask task1, ValueTask task2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask | task1 | The first task to wait on for completion.  | 
      
| ValueTask | task2 | The second task to wait on for completion.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTask> | A task that represents the completion of one of the supplied tasks. The return task's   | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAny(ValueTask, ValueTask, ValueTask)
Creates a task that will complete when any of the supplied tasks have completed.
Declaration
public static ValueTask<ValueTask> WhenAny(ValueTask task1, ValueTask task2, ValueTask task3)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask | task1 | The first task to wait on for completion.  | 
      
| ValueTask | task2 | The second task to wait on for completion.  | 
      
| ValueTask | task3 | The third task to wait on for completion.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTask> | A task that represents the completion of one of the supplied tasks. The return task's   | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAny(ValueTask, ValueTask, ValueTask, ValueTask)
Creates a task that will complete when any of the supplied tasks have completed.
Declaration
public static ValueTask<ValueTask> WhenAny(ValueTask task1, ValueTask task2, ValueTask task3, ValueTask task4)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask | task1 | The first task to wait on for completion.  | 
      
| ValueTask | task2 | The second task to wait on for completion.  | 
      
| ValueTask | task3 | The third task to wait on for completion.  | 
      
| ValueTask | task4 | The fourth task to wait on for completion.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTask> | A task that represents the completion of one of the supplied tasks. The return task's   | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAny(ValueTask, ValueTask, ValueTask, ValueTask, ValueTask)
Creates a task that will complete when any of the supplied tasks have completed.
Declaration
public static ValueTask<ValueTask> WhenAny(ValueTask task1, ValueTask task2, ValueTask task3, ValueTask task4, ValueTask task5)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask | task1 | The first task to wait on for completion.  | 
      
| ValueTask | task2 | The second task to wait on for completion.  | 
      
| ValueTask | task3 | The third task to wait on for completion.  | 
      
| ValueTask | task4 | The fourth task to wait on for completion.  | 
      
| ValueTask | task5 | The fifth task to wait on for completion.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTask> | A task that represents the completion of one of the supplied tasks. The return task's   | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAny<R>(ValueTask<R>, ValueTask<R>)
Creates a task that will complete when any of the supplied tasks have completed.
Declaration
public static ValueTask<ValueTask<R>> WhenAny<R>(ValueTask<R> task1, ValueTask<R> task2)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask<R> | task1 | The first task to wait on for completion.  | 
      
| ValueTask<R> | task2 | The second task to wait on for completion.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTask<R>> | A task that represents the completion of one of the supplied tasks. The return task's   | 
      
Type Parameters
| Name | Description | 
|---|---|
| R | The type of the result produced by the tasks.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAny<R>(ValueTask<R>, ValueTask<R>, ValueTask<R>)
Creates a task that will complete when any of the supplied tasks have completed.
Declaration
public static ValueTask<ValueTask<R>> WhenAny<R>(ValueTask<R> task1, ValueTask<R> task2, ValueTask<R> task3)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask<R> | task1 | The first task to wait on for completion.  | 
      
| ValueTask<R> | task2 | The second task to wait on for completion.  | 
      
| ValueTask<R> | task3 | The third task to wait on for completion.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTask<R>> | A task that represents the completion of one of the supplied tasks. The return task's   | 
      
Type Parameters
| Name | Description | 
|---|---|
| R | The type of the result produced by the tasks.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAny<R>(ValueTask<R>, ValueTask<R>, ValueTask<R>, ValueTask<R>)
Creates a task that will complete when any of the supplied tasks have completed.
Declaration
public static ValueTask<ValueTask<R>> WhenAny<R>(ValueTask<R> task1, ValueTask<R> task2, ValueTask<R> task3, ValueTask<R> task4)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask<R> | task1 | The first task to wait on for completion.  | 
      
| ValueTask<R> | task2 | The second task to wait on for completion.  | 
      
| ValueTask<R> | task3 | The third task to wait on for completion.  | 
      
| ValueTask<R> | task4 | The fourth task to wait on for completion.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTask<R>> | A task that represents the completion of one of the supplied tasks. The return task's   | 
      
Type Parameters
| Name | Description | 
|---|---|
| R | The type of the result produced by the tasks.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.
WhenAny<R>(ValueTask<R>, ValueTask<R>, ValueTask<R>, ValueTask<R>, ValueTask<R>)
Creates a task that will complete when any of the supplied tasks have completed.
Declaration
public static ValueTask<ValueTask<R>> WhenAny<R>(ValueTask<R> task1, ValueTask<R> task2, ValueTask<R> task3, ValueTask<R> task4, ValueTask<R> task5)
  Parameters
| Type | Name | Description | 
|---|---|---|
| ValueTask<R> | task1 | The first task to wait on for completion.  | 
      
| ValueTask<R> | task2 | The second task to wait on for completion.  | 
      
| ValueTask<R> | task3 | The third task to wait on for completion.  | 
      
| ValueTask<R> | task4 | The fourth task to wait on for completion.  | 
      
| ValueTask<R> | task5 | The fourth task to wait on for completion.  | 
      
Returns
| Type | Description | 
|---|---|
| ValueTask<ValueTask<R>> | A task that represents the completion of one of the supplied tasks. The return task's   | 
      
Type Parameters
| Name | Description | 
|---|---|
| R | The type of the result produced by the tasks.  | 
      
Remarks
This method avoid memory allocation in the managed heap if all tasks are completed (or will be soon) at the time of calling this method.