Skip to content

M_CodeJam_Threading_InterlockedOperations_Update__1

Andrew Koryavchenko edited this page Jun 17, 2018 · 6 revisions

InterlockedOperations.Update(T) Method (T, Func(T, T))

Implements lock-free update pattern implementation based on compare-and-swap loop

Namespace: CodeJam.Threading
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static T Update<T>(
	ref T value,
	Func<T, T> updateCallback
)
where T : class

VB

Public Shared Function Update(Of T As Class) ( 
	ByRef value As T,
	updateCallback As Func(Of T, T)
) As T

F#

static member Update : 
        value : 'T byref * 
        updateCallback : Func<'T, 'T> -> 'T  when 'T : not struct

Parameters

 

value
Type: T
Value to change.
updateCallback
Type: System.Func(T, T)
Function to calculate new value.

Type Parameters

 

T
[Missing documentation for "M:CodeJam.Threading.InterlockedOperations.Update1(0@,System.Func{0,0})"]

Return Value

Type: T
New value.

Remarks

Uses the same approach that used by c# compiler in event subscription methods

See Also

Reference

InterlockedOperations Class
Update Overload
CodeJam.Threading Namespace

Clone this wiki locally