Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/tink/concurrent/Mutex.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ abstract Mutex(Impl) {
static var mutex_acquire = neko.Lib.loadLazy("std","mutex_acquire",1);
static var mutex_try = neko.Lib.loadLazy("std","mutex_try",1);
}
#elseif (sys && haxe4)
@:forward(acquire, tryAcquire, release)
private abstract Impl(sys.thread.Mutex) {
public function new() {
this = new sys.thread.Mutex();
}
}
#elseif cpp
private abstract Impl(Any) {

Expand Down
9 changes: 8 additions & 1 deletion src/tink/concurrent/Queue.hx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ abstract Queue<T>(Impl<T>) {
static var deque_add = neko.Lib.loadLazy("std","deque_add",2);
static var deque_push = neko.Lib.loadLazy("std","deque_push",2);
static var deque_pop = neko.Lib.loadLazy("std","deque_pop",2);
}
}
#elseif (sys && haxe4)
@:forward(push, pop, add)
private abstract Impl<T>(sys.thread.Deque<T>) {
public function new() {
this = new sys.thread.Deque<T>();
}
}
#elseif cpp
private abstract Impl<T>(Any) {
public inline function new()
Expand Down
8 changes: 8 additions & 0 deletions src/tink/concurrent/Thread.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ abstract Thread(Impl) from Impl {
static var thread_create = neko.Lib.load("std", "thread_create", 2);
static var thread_current = neko.Lib.load("std", "thread_current", 0);
}
#elseif (sys && haxe4)
@:forward(create)
private abstract Impl(sys.thread.Thread) from sys.thread.Thread to sys.thread.Thread {
static public inline function getCurrent():Impl
return sys.thread.Thread.current();

static public inline function create(f)
return sys.thread.Thread.create(f);
}
#elseif java

private class Wrapper implements java.lang.Runnable {
Expand Down
7 changes: 7 additions & 0 deletions src/tink/concurrent/Tls.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ abstract Tls<T>(Impl<T>) from Impl<T> {
static var tls_set = neko.Lib.load("std","tls_set",2);

}
#elseif (sys && haxe4 && !java)
@:forward(value)
private abstract Impl<T>(sys.thread.Tls<T>) from sys.thread.Tls<T> to sys.thread.Tls<T> {
public function new() {
this = new sys.thread.Tls<T>();
}
}
#elseif cpp
private abstract Impl<T>(Int) {
static var sFreeSlot = 0;
Expand Down