Platforms to show: All Mac Windows Linux Cross-Platform

Back to AtomicIntegerMBS class.

AtomicIntegerMBS.Add(Value as Int64) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds an integer.

Atomically replaces the current value with the result of arithmetic addition of the value and argument.

Returns the value immediately preceding the effects of this function.

AtomicIntegerMBS.BitwiseAnd(Value as Int64) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Performs a thread safe bitwise and operation.

Atomically replaces the current value with the result of bitwise AND of the value and argument.

Returns the value immediately preceding the effects of this function.

AtomicIntegerMBS.BitwiseOr(Value as Int64) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Performs a thread safe bitwise or operation.
Example
Var a As New AtomicIntegerMBS

// put in some value
a = 2

Var x As Int64 = a.BitwiseOr(4)

// later read the value
Var Value As Int64 = a

// Value is 2 or 4 = 6

Break

Atomically replaces the current value with the result of bitwise OR of the value and argument.

Returns the value immediately preceding the effects of this function.

AtomicIntegerMBS.BitwiseXOr(Value as Int64) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Performs a thread safe bitwise xor operation.

Atomically replaces the current value with the result of bitwise XOR of the value and argument.

Returns the value immediately preceding the effects of this function.

AtomicIntegerMBS.CompareExchange(byref expected as Int64, desired as Int64) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compares value and sets to new value.
Example
Var a As New AtomicIntegerMBS

// put in some value
a = 3

// we check if value is 4, we set to 5
Var Expected1 As Int64 = 4
Var r1 As Boolean = a.CompareExchange(Expected1, 5)

// we check if value is 3, we set to 6
Var Expected2 As Int64 = 3
Var r2 As Boolean = a.CompareExchange(Expected2, 6)

// later read the value
Var Value As Int64 = a

Break

On success returns true.
On failure returns false and assigns current value to expected parameter.

Some examples using this method:

AtomicIntegerMBS.Decrement as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Decrements the value.

Returns new value.

AtomicIntegerMBS.Exchange(Value as Int64) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Exchanges current value with new value.
Example
Var a As New AtomicIntegerMBS

// put in some value
a = 3

// later read the value
Var oldValue As Int64 = a.Exchange(5)
Var NewValue As Int64 = a

Break

Returns old value.

AtomicIntegerMBS.Increment as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Increments the value.
Example
Var a As New AtomicIntegerMBS

// put in some value
a.Value = 3

// increment it from multiple threads
Call a.Increment

// later read the value
Var v As Int64 = a.Value
MessageBox v.ToString

Returns new value.

AtomicIntegerMBS.Operator_Add(other as Int64) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds a value.

AtomicIntegerMBS.Operator_Compare(other as AtomicIntegerMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compares two atomic integers.
Example
Var a As AtomicIntegerMBS = 123
Var b As AtomicIntegerMBS = 234

If a < b Then
// works
Break
Else
// failed
Break
End If

If a > b Then
// failed
Break
Else
// works
Break
End If

AtomicIntegerMBS.Operator_Convert as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Converts value to integer.
Example
Var a As New AtomicIntegerMBS

// put in some value
a = 3

// later read the value
Var v As Int64 = a
MessageBox v.ToString

See also:

AtomicIntegerMBS.Operator_Convert(value as Int64)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Converts value on assignment.

See also:

AtomicIntegerMBS.Operator_Subtract(other as Int64) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Subtracts a value.

AtomicIntegerMBS.Subtract(Value as Int64) as Int64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Atomic MBS Util Plugin 25.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Subtracts a value.

Atomically replaces the current value with the result of arithmetic addition of the value and argument.

Returns the value immediately preceding the effects of this function.

The items on this page are in the following plugins: MBS Util Plugin.


The biggest plugin in space...