-
Notifications
You must be signed in to change notification settings - Fork 35
M_CodeJam_Threading_InterlockedOperations_Update_2
Andrew Koryavchenko edited this page Jun 17, 2018
·
6 revisions
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
C#
public static int Update(
ref int value,
Func<int, int> updateCallback
)
VB
Public Shared Function Update (
ByRef value As Integer,
updateCallback As Func(Of Integer, Integer)
) As Integer
F#
static member Update :
value : int byref *
updateCallback : Func<int, int> -> int
- value
- Type: System.Int32
Value to change. - updateCallback
- Type: System.Func(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