ImmutableInterlocked.Update Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| Update<T,TArg>(T, Func<T,TArg,T>, TArg) |
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race. |
| Update<T>(T, Func<T,T>) |
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race. |
Update<T,TArg>(T, Func<T,TArg,T>, TArg)
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.
public:
generic <typename T, typename TArg>
where T : class static bool Update(T % location, Func<T, TArg, T> ^ transformer, TArg transformerArgument);
public static bool Update<T,TArg>(ref T location, Func<T,TArg,T> transformer, TArg transformerArgument) where T : class;
static member Update : 'T * Func<'T, 'Arg, 'T (requires 'T : null and 'T : null)> * 'Arg -> bool (requires 'T : null)
Public Shared Function Update(Of T As Class, TArg As Class) (ByRef location As T, transformer As Func(Of T, TArg, T), transformerArgument As TArg) As Boolean
Type Parameters
- T
The type of data.
- TArg
The type of argument passed to the transformer.
Parameters
- location
- T
The variable or field to be changed, which may be accessed by multiple threads.
- transformer
- Func<T,TArg,T>
A function that mutates the value. This function should be side-effect free, as it may run multiple times when races occur with other threads.
- transformerArgument
- TArg
The argument to pass to transformer.
Returns
true if the location's value is changed by applying the result of the transformer function; false if the location's value remained the same because the last invocation of transformer returned the existing value.
Applies to
Update<T>(T, Func<T,T>)
Mutates a value in-place with optimistic locking transaction semantics via a specified transformation function. The transformation is retried as many times as necessary to win the optimistic locking race.
public:
generic <typename T>
where T : class static bool Update(T % location, Func<T, T> ^ transformer);
public static bool Update<T>(ref T location, Func<T,T> transformer) where T : class;
static member Update : 'T * Func<'T, 'T (requires 'T : null and 'T : null)> -> bool (requires 'T : null)
Public Shared Function Update(Of T As Class) (ByRef location As T, transformer As Func(Of T, T)) As Boolean
Type Parameters
- T
The type of data.
Parameters
- location
- T
The variable or field to be changed, which may be accessed by multiple threads.
- transformer
- Func<T,T>
A function that mutates the value. This function should be side-effect free, as it may run multiple times when races occur with other threads.
Returns
true if the location's value is changed by applying the result of the transformer function; false if the location's value remained the same because the last invocation of transformer returned the existing value.