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
| Type | Description |
|---|
int32 | The 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
| Name | Type | Description |
|---|
| old | int32 | The expected current value of the Int32. |
| new | int32 | The new value to set if 'old' matches the current value. |
Returns
| Type | Description |
|---|
bool | True 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
| Name | Type | Description |
|---|
| delta | int32 | The 32-bit integer value to add to the current value. |
Returns
| Type | Description |
|---|
int32 | The 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
| Name | Type | Description |
|---|
| delta | int32 | The 32-bit integer value to subtract from the current value. |
Returns
| Type | Description |
|---|
int32 | The 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
| Type | Description |
|---|
int32 | The 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
| Type | Description |
|---|
int32 | The 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
| Name | Type | Description |
|---|
| v | int32 | The new 32-bit integer value to store. |