Просмотр исходного кода

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

Aleksandr Kuzmenko 4 лет назад
Родитель
Сommit
8f58c3138c
1 измененных файлов с 10 добавлено и 4 удалено
  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;
 package sys.thread;
 
 
-@:forward(release)
-abstract Lock(NativeSemaphore) {
+@:coreApi
+class Lock {
+	final semaphore:NativeSemaphore;
+
 	public inline function new() {
 	public inline function new() {
-		this = new NativeSemaphore(0);
+		semaphore = new NativeSemaphore(0);
 	}
 	}
 
 
 	public inline function wait(?timeout:Float):Bool {
 	public inline function wait(?timeout:Float):Bool {
-		return this.acquire(true, timeout);
+		return semaphore.acquire(true, timeout);
+	}
+
+	public inline function release():Void {
+		semaphore.release();
 	}
 	}
 }
 }