Skip to content

M_CodeJam_Threading_InterlockedOperations_Initialize_1

andrewvk edited this page Jul 1, 2016 · 5 revisions

InterlockedOperations.Initialize Method (Double, Double, Double)

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: 1.1.0.0 (1.1.0.0)

Syntax

C#

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

VB

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

F#

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

Parameters

 

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

Return Value

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

See Also

Reference

InterlockedOperations Class
Initialize Overload
CodeJam.Threading Namespace

Clone this wiki locally