Skip to content

Add mechanism to wake native loop#12993

Open
kevinresol wants to merge 1 commit into
HaxeFoundation:developmentfrom
kevinresol:eventloop-native-wake
Open

Add mechanism to wake native loop#12993
kevinresol wants to merge 1 commit into
HaxeFoundation:developmentfrom
kevinresol:eventloop-native-wake

Conversation

@kevinresol

@kevinresol kevinresol commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Two changes so Haxe EventLoop works correctly with a blocking native loop (e.g. libuv UV_RUN_ONCE on HashLink):

  1. nativeLoop.run(maxBlock) — pass the next Haxe event deadline into the native loop so a blocked poll returns when a Haxe timer is due, even if no I/O is ready.
  2. nativeLoop.wake() — cross-thread enqueue calls this (via EventLoop.wakeup()) so another thread posting work can unblock a poll that would otherwise wait indefinitely.

Together these replace the previous HL busy-spin on UV_RUN_NOWAIT with a proper sleep/wake model: the OS poller blocks when idle, and wakes for either native I/O, a Haxe deadline, or a cross-thread task.

Pair with HaxeFoundation/hashlink#958

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant