Uint32
No overview available.
Methods
Load()
@classmethod
def Load() - > uint32
Loads the current value of the Uint32. Callers use this to retrieve the integer value stored in the object.
Returns
| Type | Description |
|---|---|
uint32 | The current 32-bit unsigned integer value. |
CompareAndSwap()
@classmethod
def CompareAndSwap(
old: uint32,
new: uint32
) - > bool
Atomically compares the current value with 'old' and, if they are equal, replaces the current value with 'new'. This is used for concurrent updates to ensure data integrity.
Parameters
| Name | Type | Description |
|---|---|---|
| old | uint32 | The expected current 32-bit unsigned integer value for the comparison. |
| new | uint32 | The new 32-bit unsigned integer value to set if the comparison succeeds. |
Returns
| Type | Description |
|---|---|
bool | True if the swap was successful (i.e., the current value matched 'old' and was updated to 'new'), otherwise False. |
Add()
@classmethod
def Add(
delta: uint32
) - > uint32
Atomically adds the 'delta' value to the current Uint32 value and returns the new value. This is useful for atomically incrementing a counter.
Parameters
| Name | Type | Description |
|---|---|---|
| delta | uint32 | The 32-bit unsigned integer value to add to the current value. |
Returns
| Type | Description |
|---|---|
uint32 | The new 32-bit unsigned integer value after the addition. |
Inc()
@classmethod
def Inc() - > uint32
Atomically increments the Uint32 value by one and returns the new value. This is a convenience method for simple atomic increments.
Returns
| Type | Description |
|---|---|
uint32 | The new 32-bit unsigned integer value after the increment. |
Store()
@classmethod
def Store(
v: uint32
)
Atomically stores the provided 32-bit unsigned integer value into the Uint32. Callers use this to set the integer value of the object.
Parameters
| Name | Type | Description |
|---|---|---|
| v | uint32 | The 32-bit unsigned integer value to store. |