AtomicInt
An integer shared by a native library and Haxe. Either side reads and writes it from any thread without a native call.
The cell is four bytes of memory that both this runtime's atomic operations and the library's operate on. A cell created here with new can be passed to a native call, which borrows it for the duration of the call. A cell returned by a library is in the library's memory and is read and written from Haxe directly. The operations are those of haxe.atomic.AtomicInt.
Constructor
function new(?value:Int = 0)Static methods
function over(pointer:Ref<Int>, keep:Any):AtomicIntWraps the cell at pointer. Its memory stays valid as long as keep is referenced.
Properties
var pointer(get, null):Ref<Int>The pointer a binding passes to a native call that has the cell as a parameter.
var load(default, null):() -> Intvar store(default, null):(value:Int) -> IntSets the value and returns the new value.
var add(default, null):(by:Int) -> IntAdds by and returns the previous value.
var sub(default, null):(by:Int) -> IntSubtracts by and returns the previous value.
var and(default, null):(bits:Int) -> Intvar or(default, null):(bits:Int) -> Intvar xor(default, null):(bits:Int) -> Intvar exchange(default, null):(value:Int) -> IntSets the value and returns the previous value.
var compareExchange(default, null):(expected:Int, replacement:Int) -> IntSets the value if it equals expected. Returns the previous value in both cases.