diff --git a/src/tink/concurrent/Mutex.hx b/src/tink/concurrent/Mutex.hx index aa42898..3fa1a5d 100644 --- a/src/tink/concurrent/Mutex.hx +++ b/src/tink/concurrent/Mutex.hx @@ -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) { diff --git a/src/tink/concurrent/Queue.hx b/src/tink/concurrent/Queue.hx index a86a10a..e53f41c 100644 --- a/src/tink/concurrent/Queue.hx +++ b/src/tink/concurrent/Queue.hx @@ -34,7 +34,14 @@ abstract Queue(Impl) { 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(sys.thread.Deque) { + public function new() { + this = new sys.thread.Deque(); + } + } #elseif cpp private abstract Impl(Any) { public inline function new() diff --git a/src/tink/concurrent/Thread.hx b/src/tink/concurrent/Thread.hx index d784f58..9fee6a1 100644 --- a/src/tink/concurrent/Thread.hx +++ b/src/tink/concurrent/Thread.hx @@ -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 { diff --git a/src/tink/concurrent/Tls.hx b/src/tink/concurrent/Tls.hx index 390e902..57eae6c 100644 --- a/src/tink/concurrent/Tls.hx +++ b/src/tink/concurrent/Tls.hx @@ -31,6 +31,13 @@ abstract Tls(Impl) from Impl { static var tls_set = neko.Lib.load("std","tls_set",2); } + #elseif (sys && haxe4 && !java) + @:forward(value) + private abstract Impl(sys.thread.Tls) from sys.thread.Tls to sys.thread.Tls { + public function new() { + this = new sys.thread.Tls(); + } + } #elseif cpp private abstract Impl(Int) { static var sFreeSlot = 0;