Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ jobs:
haxelib install hxp --quiet
haxelib install utest --quiet

- name: Enable HXCPP compile cache
run: |
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV

- name: Rebuild Lime tools
run: |
haxelib dev lime ${{ github.workspace }}
Expand Down Expand Up @@ -728,7 +724,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.6]
haxe-version: [4.0.5, 4.1.5, 4.2.5, 4.3.7]
steps:

- uses: actions/checkout@v6
Expand Down Expand Up @@ -882,7 +878,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
haxe-version: [3.4.7, 4.0.5, 4.1.5, 4.2.5, 4.3.6]
haxe-version: [3.4.7, 4.0.5, 4.1.5, 4.2.5, 4.3.7]
steps:

- uses: actions/checkout@v6
Expand Down
10 changes: 9 additions & 1 deletion src/lime/_internal/backend/native/NativeApplication.hx
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,15 @@ class NativeApplication
});
}
}
#if (haxe_ver >= 4.2)
#if haxe5
#if target.threaded
sys.thread.Thread.current().events.loopOnce();
#else
// Duplicate code required because Haxe 3 can't handle
// #if (haxe_ver >= 4.2 && target.threaded)
@:privateAccess haxe.EntryPoint.processEvents();
#end
#elseif (haxe_ver >= 4.2)
#if target.threaded
sys.thread.Thread.current().events.progress();
#else
Expand Down
24 changes: 24 additions & 0 deletions src/lime/_internal/utils/MainLoop.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package lime._internal.utils;

#if haxe5
import haxe.EventLoop;

/**
* Wrapper for compatibility with Haxe 5.
*/
@:forwardStatics
abstract MainLoop(haxe.MainLoop)
{
public static inline function runInMainThread(f:Void->Void)
{
EventLoop.main.run(f);
}

public static inline function addThread(f:Void->Void)
{
EventLoop.addTask(f);
}
}
#else
typedef MainLoop = haxe.MainLoop;
#end
7 changes: 4 additions & 3 deletions src/lime/app/Promise.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package lime.app;

import lime._internal.utils.MainLoop;
import lime.app.Future;
import lime.system.ThreadPool;
import lime.system.WorkOutput;
Expand Down Expand Up @@ -105,7 +106,7 @@ class Promise<T>
{
if (!ThreadPool.isMainThread())
{
haxe.MainLoop.runInMainThread(complete.bind(data));
MainLoop.runInMainThread(complete.bind(data));
return this;
}

Expand Down Expand Up @@ -197,7 +198,7 @@ class Promise<T>
{
if (!ThreadPool.isMainThread())
{
haxe.MainLoop.runInMainThread(error.bind(msg));
MainLoop.runInMainThread(error.bind(msg));
return this;
}

Expand Down Expand Up @@ -236,7 +237,7 @@ class Promise<T>
{
if (!ThreadPool.isMainThread())
{
haxe.MainLoop.runInMainThread(this.progress.bind(progress, total));
MainLoop.runInMainThread(this.progress.bind(progress, total));
return this;
}

Expand Down