|
@@ -22,6 +22,9 @@
|
|
|
|
|
|
package sys.thread;
|
|
package sys.thread;
|
|
|
|
|
|
|
|
+import python.lib.threading.Thread as NativeThread;
|
|
|
|
+import python.lib.Threading;
|
|
|
|
+
|
|
import haxe.ds.ObjectMap;
|
|
import haxe.ds.ObjectMap;
|
|
|
|
|
|
private typedef ThreadImpl = HxThread;
|
|
private typedef ThreadImpl = HxThread;
|
|
@@ -78,7 +81,7 @@ private class HxThread {
|
|
static function __init__() {
|
|
static function __init__() {
|
|
threads = new ObjectMap();
|
|
threads = new ObjectMap();
|
|
threadsMutex = new Mutex();
|
|
threadsMutex = new Mutex();
|
|
- mainThread = new HxThread(PyThreadingAPI.current_thread());
|
|
|
|
|
|
+ mainThread = new HxThread(Threading.current_thread());
|
|
mainThread.events = new EventLoop();
|
|
mainThread.events = new EventLoop();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -92,8 +95,8 @@ private class HxThread {
|
|
|
|
|
|
public static function current():HxThread {
|
|
public static function current():HxThread {
|
|
threadsMutex.acquire();
|
|
threadsMutex.acquire();
|
|
- var ct = PyThreadingAPI.current_thread();
|
|
|
|
- if (ct == PyThreadingAPI.main_thread()) {
|
|
|
|
|
|
+ var ct = Threading.current_thread();
|
|
|
|
+ if (ct == Threading.main_thread()) {
|
|
threadsMutex.release();
|
|
threadsMutex.release();
|
|
return mainThread;
|
|
return mainThread;
|
|
}
|
|
}
|
|
@@ -159,17 +162,3 @@ private class HxThread {
|
|
return current().messages.pop(block);
|
|
return current().messages.pop(block);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
-@:pythonImport("threading", "Thread")
|
|
|
|
-@:native("Thread")
|
|
|
|
-private extern class NativeThread {
|
|
|
|
- function new(group:Dynamic, target:Void->Void);
|
|
|
|
- function start():Void;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-@:pythonImport("threading")
|
|
|
|
-@:native("threading")
|
|
|
|
-private extern class PyThreadingAPI {
|
|
|
|
- static function current_thread():NativeThread;
|
|
|
|
- static function main_thread():NativeThread;
|
|
|
|
-}
|
|
|