Skip to main content

Int32

No overview available.

Methods


Load()

@classmethod
def Load() - > int32

Loads the current value of the Int32. Callers use this to retrieve the integer value stored in the object.

Returns

TypeDescription
int32The current 32-bit integer value.

CompareAndSwap()

@classmethod
def CompareAndSwap(
old: int32,
new: int32
) - > bool

Compares the current value with 'old' and, if they are equal, atomically replaces the current value with 'new'. This is used for thread-safe updates where the update should only occur if the value hasn't changed since it was last read.

Parameters

NameTypeDescription
oldint32The expected current value of the Int32.
newint32The new value to set if 'old' matches the current value.

Returns

TypeDescription
boolTrue if the swap occurred (i.e., the old value matched the current value), false otherwise.

Add()

@classmethod
def Add(
delta: int32
) - > int32

Adds a delta to the current value of the Int32 and returns the new value. This operation is atomic, ensuring thread-safe increments.

Parameters

NameTypeDescription
deltaint32The 32-bit integer value to add to the current value.

Returns

TypeDescription
int32The new 32-bit integer value after the addition.

Sub()

@classmethod
def Sub(
delta: int32
) - > int32

Subtracts a delta from the current value of the Int32 and returns the new value. This operation is atomic, ensuring thread-safe decrements.

Parameters

NameTypeDescription
deltaint32The 32-bit integer value to subtract from the current value.

Returns

TypeDescription
int32The new 32-bit integer value after the subtraction.

Inc()

@classmethod
def Inc() - > int32

Increments the current value of the Int32 by 1 and returns the new value. This provides a convenient and atomic way to increase the counter.

Returns

TypeDescription
int32The new 32-bit integer value after incrementing.

Dec()

@classmethod
def Dec() - > int32

Decrements the current value of the Int32 by 1 and returns the new value. This provides a convenient and atomic way to decrease the counter.

Returns

TypeDescription
int32The new 32-bit integer value after decrementing.

Store()

@classmethod
def Store(
v: int32
)

Stores a new value into the Int32, replacing its current content. This operation is atomic, ensuring thread-safe assignment.

Parameters

NameTypeDescription
vint32The new 32-bit integer value to store.