2
0
Эх сурвалжийг харах

[cpp] Add cpp::AtomicInt type

Hugh 9 жил өмнө
parent
commit
bb3256622d
1 өөрчлөгдсөн 18 нэмэгдсэн , 0 устгасан
  1. 18 0
      std/cpp/AtomicInt.hx

+ 18 - 0
std/cpp/AtomicInt.hx

@@ -0,0 +1,18 @@
+package cpp;
+
+@:scalar @:coreType
+extern abstract AtomicInt from(Int) to(Int)
+{
+   // returns true if exchange took place
+   @:native("_hx_atomic_exchange_if")
+   public static function exchangeIf(ioValue:Pointer<AtomicInt>, test:Int, newVal:Int) : Bool;
+
+   // returns value before increment
+   @:native("_hx_atomic_inc")
+   public static function atomicInc(ioValue:Pointer<AtomicInt>) : Int;
+
+   // returns value before decrement
+   @:native("_hx_atomic_dec")
+   public static function atomicDec(ioValue:Pointer<AtomicInt>) : Int;
+}
+