- 
                Notifications
    
You must be signed in to change notification settings  - Fork 35
 
M_CodeJam_Threading_InterlockedOperations_Update_3
        Andrew Koryavchenko edited this page Jul 4, 2017 
        ·
        6 revisions
      
    Implements lock-free update pattern implementation based on compare-and-swap loop
Namespace: CodeJam.Threading
Assembly: CodeJam (in CodeJam.dll) Version: 1.1.0.0 (1.1.0.0)
C#
public static int Update(
	ref int value,
	int newValue,
	Func<int, int, int> updateCallback
)VB
Public Shared Function Update ( 
	ByRef value As Integer,
	newValue As Integer,
	updateCallback As Func(Of Integer, Integer, Integer)
) As IntegerF#
static member Update : 
        value : int byref * 
        newValue : int * 
        updateCallback : Func<int, int, int> -> int 
- value
 - Type: System.Int32
Value to change. - newValue
 - Type: System.Int32
Precalculated new value. - updateCallback
 - Type: System.Func(Int32, Int32, Int32)
Function to calculate new value. 
Type: Int32
New value.
Uses the same approach that used by c# compiler in event subscription methods
InterlockedOperations Class
Update Overload
CodeJam.Threading Namespace