Ver código fonte

[python] transformed sys.thread.Lock into a class as it is on other targets

Aleksandr Kuzmenko 4 anos atrás
pai
commit
8f58c3138c
1 arquivos alterados com 10 adições e 4 exclusões
  1. 10 4
      std/python/_std/sys/thread/Lock.hx

+ 10 - 4
std/python/_std/sys/thread/Lock.hx

@@ -22,14 +22,20 @@
 
 package sys.thread;
 
-@:forward(release)
-abstract Lock(NativeSemaphore) {
+@:coreApi
+class Lock {
+	final semaphore:NativeSemaphore;
+
 	public inline function new() {
-		this = new NativeSemaphore(0);
+		semaphore = new NativeSemaphore(0);
 	}
 
 	public inline function wait(?timeout:Float):Bool {
-		return this.acquire(true, timeout);
+		return semaphore.acquire(true, timeout);
+	}
+
+	public inline function release():Void {
+		semaphore.release();
 	}
 }