Skip to content

M_CodeJam_Threading_InterlockedOperations_Update_7

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

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

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 float Update(
	ref float value,
	float newValue,
	Func<float, float, float> updateCallback
)

VB

Public Shared Function Update ( 
	ByRef value As Single,
	newValue As Single,
	updateCallback As Func(Of Single, Single, Single)
) As Single

F#

static member Update : 
        value : float32 byref * 
        newValue : float32 * 
        updateCallback : Func<float32, float32, float32> -> float32 

Parameters

 

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

Return Value

Type: Single
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