From 7890951d12186e86c5a6acedcbfb3b715b8a8fb8 Mon Sep 17 00:00:00 2001 From: Joseph Cloutier Date: Mon, 30 May 2022 16:37:43 -0400 Subject: [PATCH] Add `MainLoop` support. Pros: It's a standard Haxe feature that other Haxelibs may rely on. Plus it offers built-in thread safety, unlike `onUpdate`. Cons: It incurs two `mutex.acquire()` calls per frame. --- src/lime/_internal/backend/native/NativeApplication.hx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lime/_internal/backend/native/NativeApplication.hx b/src/lime/_internal/backend/native/NativeApplication.hx index c909e1f63..478c07299 100644 --- a/src/lime/_internal/backend/native/NativeApplication.hx +++ b/src/lime/_internal/backend/native/NativeApplication.hx @@ -600,6 +600,16 @@ class NativeApplication }); } } + + #if target.threaded + sys.thread.Thread.current().events.progress(); + #elseif cpp + cpp.vm.Thread.current().events.progress(); + #elseif neko + neko.vm.Thread.current().events.progress(); + #else + @:privateAccess haxe.EntryPoint.processEvents(); + #end #end } }