Skip to content

Commit

Permalink
Fix doc gen for atomics, conditions and semaphores. (#10949)
Browse files Browse the repository at this point in the history
Fixes #10948
Fixes #10947
  • Loading branch information
Apprentice-Alchemist authored Jan 30, 2023
1 parent 0d61141 commit 569b486
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 31 deletions.
1 change: 0 additions & 1 deletion std/cpp/_std/haxe/atomic/AtomicInt.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package haxe.atomic;

@:noDoc
#if cppia
extern
#end
Expand Down
1 change: 0 additions & 1 deletion std/cpp/_std/sys/thread/Condition.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sys.thread;

@:noDoc
@:coreApi
class Condition {
var c:Dynamic;
Expand Down
1 change: 0 additions & 1 deletion std/cpp/_std/sys/thread/Semaphore.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sys.thread;

@:noDoc
@:coreApi
class Semaphore {
var m:Dynamic;
Expand Down
3 changes: 1 addition & 2 deletions std/cs/_std/haxe/atomic/AtomicInt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ private class IntWrapper {
}
}

@:noDoc
abstract AtomicInt(IntWrapper) to IntWrapper {
abstract AtomicInt(IntWrapper) {
public inline function new(value:Int) {
this = new IntWrapper(value);
}
Expand Down
1 change: 0 additions & 1 deletion std/cs/_std/sys/thread/Condition.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sys.thread;

import cs.system.threading.Monitor;

@:noDoc
@:coreApi
@:access(sys.thread.Mutex)
class Condition {
Expand Down
1 change: 0 additions & 1 deletion std/cs/_std/sys/thread/Semaphore.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sys.thread;

@:noDoc
@:coreApi
class Semaphore {
final native:cs.system.threading.Semaphore;
Expand Down
1 change: 0 additions & 1 deletion std/eval/_std/sys/thread/Condition.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sys.thread;

@:noDoc
@:coreApi class Condition {
final cond:eval.luv.Condition;
final mutex:eval.luv.Mutex;
Expand Down
1 change: 0 additions & 1 deletion std/eval/_std/sys/thread/Semaphore.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sys.thread;

@:noDoc
@:coreApi class Semaphore {
final native:eval.luv.Semaphore;

Expand Down
1 change: 0 additions & 1 deletion std/haxe/atomic/AtomicInt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package haxe.atomic;
Atomic integer.
(js) The Atomics and SharedArrayBuffer objects need to be available. Errors will be thrown if this is not the case.
**/
@:noDoc
@:coreType
abstract AtomicInt {
public function new(value:Int):Void;
Expand Down
1 change: 0 additions & 1 deletion std/hl/_std/haxe/atomic/AtomicInt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package haxe.atomic;
#end
import hl.Atomics;

@:noDoc
abstract AtomicInt(hl.NativeArray<Int>) {
public inline function new(value:Int):Void {
this = new hl.NativeArray(1);
Expand Down
19 changes: 18 additions & 1 deletion std/hl/_std/sys/thread/Condition.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
package sys.thread;

@:noDoc
#if doc_gen
@:coreApi extern class Condition {
function new():Void;

public function acquire():Void;

public function tryAcquire():Bool;

public function release():Void;

public function wait():Void;

public function signal():Void;

public function broadcast():Void;
}
#else
abstract Condition(hl.Abstract<"hl_condition">) {
public function new():Void {
this = alloc();
Expand Down Expand Up @@ -31,3 +47,4 @@ abstract Condition(hl.Abstract<"hl_condition">) {
return null;
}
}
#end
10 changes: 9 additions & 1 deletion std/hl/_std/sys/thread/Semaphore.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package sys.thread;

@:noDoc
#if doc_gen
@:coreApi extern class Semaphore {
function new(value:Int):Void;
function acquire():Void;
function tryAcquire(?timeout:Float):Bool;
function release():Void;
}
#else
abstract Semaphore(hl.Abstract<"hl_semaphore">) {
public function new(value:Int):Void {
this = alloc(value);
Expand All @@ -22,3 +29,4 @@ abstract Semaphore(hl.Abstract<"hl_semaphore">) {
return null;
}
}
#end
1 change: 0 additions & 1 deletion std/java/_std/haxe/atomic/AtomicInt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package haxe.atomic;

import java.util.concurrent.atomic.AtomicInteger;

@:noDoc
abstract AtomicInt(AtomicInteger) {
public inline function new(value:Int) {
this = new AtomicInteger(value);
Expand Down
1 change: 0 additions & 1 deletion std/java/_std/sys/thread/Condition.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sys.thread;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.Condition as NativeCondition;

@:noDoc
@:access(sys.thread.Mutex)
@:coreApi
@:native('haxe.java.vm.Condition')
Expand Down
1 change: 0 additions & 1 deletion std/java/_std/sys/thread/Semaphore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sys.thread;

import java.util.concurrent.TimeUnit;

@:noDoc
@:coreApi
@:native('haxe.java.vm.Semaphore')
class Semaphore {
Expand Down
25 changes: 14 additions & 11 deletions std/js/_std/haxe/atomic/AtomicInt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,49 @@ package haxe.atomic;

import js.lib.Atomics;

@:noDoc
abstract AtomicInt(js.lib.Int32Array) to js.lib.Int32Array {
abstract AtomicInt(js.lib.Int32Array) {
public inline function new(value:Int) {
this = new js.lib.Int32Array(new js.lib.SharedArrayBuffer(js.lib.Int32Array.BYTES_PER_ELEMENT));
this[0] = value;
}

private function asArray():js.lib.Int32Array {
return this;
}

public inline function add(b:Int):Int {
return Atomics.add(this, 0, b);
return Atomics.add(asArray(), 0, b);
}

public inline function sub(b:Int):Int {
return Atomics.sub(this, 0, b);
return Atomics.sub(asArray(), 0, b);
}

public inline function and(b:Int):Int {
return Atomics.and(this, 0, b);
return Atomics.and(asArray(), 0, b);
}

public inline function or(b:Int):Int {
return Atomics.or(this, 0, b);
return Atomics.or(asArray(), 0, b);
}

public inline function xor(b:Int):Int {
return Atomics.xor(this, 0, b);
return Atomics.xor(asArray(), 0, b);
}

public inline function compareExchange(expected:Int, replacement:Int):Int {
return Atomics.compareExchange(this, 0, expected, replacement);
return Atomics.compareExchange(asArray(), 0, expected, replacement);
}

public inline function exchange(value:Int):Int {
return Atomics.exchange(this, 0, value);
return Atomics.exchange(asArray(), 0, value);
}

public inline function load():Int {
return Atomics.load(this, 0);
return Atomics.load(asArray(), 0);
}

public inline function store(value:Int):Int {
return Atomics.store(this, 0, value);
return Atomics.store(asArray(), 0, value);
}
}
1 change: 0 additions & 1 deletion std/python/_std/sys/thread/Condition.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package sys.thread;

@:noDoc
@:coreApi
class Condition {
final cond:python.lib.threading.Condition;
Expand Down
1 change: 0 additions & 1 deletion std/python/_std/sys/thread/Semaphore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sys.thread;

import python.lib.threading.Semaphore as NativeSemaphore;

@:noDoc
@:coreApi
class Semaphore {
final semaphore:NativeSemaphore;
Expand Down
1 change: 0 additions & 1 deletion std/sys/thread/Condition.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ package sys.thread;
until another thread modifies a shared variable (the condition)
and signals the condition variable.
**/
@:noDoc
@:coreApi extern class Condition {
/**
Create a new condition variable.
Expand Down
1 change: 0 additions & 1 deletion std/sys/thread/Semaphore.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sys.thread;
#if (!target.threaded)
#error "This class is not available on this target"
#end
@:noDoc
@:coreApi extern class Semaphore {
/**
Creates a new semaphore with an initial value.
Expand Down

0 comments on commit 569b486

Please sign in to comment.