diff --git a/src/lime/_internal/backend/native/NativeApplication.hx b/src/lime/_internal/backend/native/NativeApplication.hx index d4e2813adb..a259833b91 100644 --- a/src/lime/_internal/backend/native/NativeApplication.hx +++ b/src/lime/_internal/backend/native/NativeApplication.hx @@ -607,7 +607,11 @@ class NativeApplication #if (haxe_ver >= 4.2) #if target.threaded + #if (haxe_ver >= 5) + sys.thread.Thread.current().events.loopOnce(); + #else sys.thread.Thread.current().events.progress(); + #end #else // Duplicate code required because Haxe 3 can't handle // #if (haxe_ver >= 4.2 && target.threaded) diff --git a/src/lime/system/JNI.hx b/src/lime/system/JNI.hx index b1a052022b..ce223c9926 100644 --- a/src/lime/system/JNI.hx +++ b/src/lime/system/JNI.hx @@ -466,9 +466,13 @@ class JNISafetyTools // Check the thread before running the function. f.expr = macro - if (!lime.system.JNI.JNISafetyTools.onMainThread()) - haxe.MainLoop.runInMainThread($i{field.name}.bind($a{args})) - else + if (!lime.system.JNI.JNISafetyTools.onMainThread()) { + #if haxe5 + haxe.EventLoop.main.run($i{field.name}.bind($a{args})); + #else + haxe.MainLoop.runInMainThread($i{field.name}.bind($a{args})); + #end + } else ${f.expr}; default: }