Skip to content

M_CodeJam_Threading_InterlockedOperations_Initialize_5

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

InterlockedOperations.Initialize Method (Int64, Int64, Int64)

Initialize the value referenced by target in a thread-safe manner. The value is changed to initializedValue only if the current value is uninitializedValue.

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

Syntax

C#

public static long Initialize(
	ref long target,
	long initializedValue,
	long uninitializedValue
)

VB

Public Shared Function Initialize ( 
	ByRef target As Long,
	initializedValue As Long,
	uninitializedValue As Long
) As Long

F#

static member Initialize : 
        target : int64 byref * 
        initializedValue : int64 * 
        uninitializedValue : int64 -> int64 

Parameters

 

target
Type: System.Int64
Reference to the target location.
initializedValue
Type: System.Int64
The value to use if the target is currently uninitialized.
uninitializedValue
Type: System.Int64
The uninitialized value.

Return Value

Type: Int64
The new value referenced by target. Note that this is nearly always more useful than the usual return from CompareExchange(Int64, Int64, Int64) because it saves another read to target.

See Also

Reference

InterlockedOperations Class
Initialize Overload
CodeJam.Threading Namespace

Clone this wiki locally