Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[browser][MT] invocation of user JS in UI thread till next event loop tick #100040

Merged
merged 3 commits into from
Mar 21, 2024

Conversation

pavelsavara
Copy link
Member

postpone invocation of user JS in UI thread till next event loop tick, so that em_task_queue_execute is not blocked by it.
That allows emscripten_yield to process FS POSIX calls even if the UI is spin-waiting for the return from synchonous call to JSExport

  • new args field SyncDoneSemaphorePtr
  • new invoke_later_when_on_ui_thread_sync
  • new invoke_later_when_on_ui_thread_async which postpone invocation of user code till next event loop tick
  • rename mono_wasm_invoke_jsimport_MT
  • test in browser-threads sample, more tests in next PR

 - new invoke_later_when_on_ui_thread_sync and invoke_later_when_on_ui_thread_async which postpone invocation of user code till next event loop tick
 - rename mono_wasm_invoke_jsimport_MT
 - test in browser-threads sample, more tests in next PR
@pavelsavara pavelsavara added arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm labels Mar 20, 2024
@pavelsavara pavelsavara added this to the 9.0.0 milestone Mar 20, 2024
@pavelsavara pavelsavara self-assigned this Mar 20, 2024
@pavelsavara pavelsavara requested review from kg and maraf March 20, 2024 20:59
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

@pavelsavara pavelsavara changed the title [browser][MT] postpone invocation of user JS in UI thread till next event loop tick [browser][MT] invocation of user JS in UI thread till next event loop tick Mar 20, 2024
@pavelsavara pavelsavara marked this pull request as ready for review March 21, 2024 12:21
src/mono/browser/runtime/marshal-to-js.ts Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to rewrite the sample as WBT test app 🤞

@pavelsavara
Copy link
Member Author

/ba-g there is Log which is known issue #99961

@pavelsavara pavelsavara merged commit adb639c into dotnet:main Mar 21, 2024
96 of 98 checks passed
@pavelsavara pavelsavara deleted the browser_mt_enable_fs_in_sync branch March 21, 2024 15:49
@github-actions github-actions bot locked and limited conversation to collaborators Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-threading-mono os-browser Browser variant of arch-wasm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants