-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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] GC, threadpool and some JS interop improvements #86759
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tagging subscribers to 'arch-wasm': @lewing Issue Detailswork in progress
|
pavelsavara
force-pushed
the
browser_threads_next
branch
2 times, most recently
from
May 29, 2023 21:24
d6d63df
to
114268b
Compare
pavelsavara
changed the title
[draft][browser] thread experiments
[browser][MT] GC, threadpool and some JS interop improvements
May 31, 2023
pavelsavara
requested review from
lewing,
kg,
lambdageek,
vargaz,
SamMonoRT,
lateralusX,
BrzVlad,
thaystg and
marek-safar
as code owners
May 31, 2023 16:52
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
pavelsavara
commented
May 31, 2023
pavelsavara
commented
May 31, 2023
This comment was marked as resolved.
This comment was marked as resolved.
lambdageek
reviewed
May 31, 2023
This comment was marked as resolved.
This comment was marked as resolved.
kg
reviewed
Jun 2, 2023
...ervices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSSynchronizationContext.cs
Outdated
Show resolved
Hide resolved
kg
reviewed
Jun 2, 2023
...ervices.JavaScript/src/System/Runtime/InteropServices/JavaScript/JSSynchronizationContext.cs
Show resolved
Hide resolved
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
This was referenced Jun 9, 2023
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes GC, threadpool and some JS interop scenarios work on the mini sample
Changes
JSSynchronizationContext
- could be installed on multiple threadsInstallWebWorkerInterop
andUninstallWebWorkerInterop
JSSynchronizationContext
is automatically installed on the main threadmono_target_thread_schedule_background_job
helps to implement thatexternal_eventloop
andthread_id
private fields ofThread
are accessed via reflection. I don't know about better way right now.System.Runtime.InteropServices.JavaScript.WebWorker
for starting threads dedicated to JS interopRun
method accepts synchronousAction
.RunAsync
acceptsFunc<Task>
and enables JS interop as well as async JSImport/JSExport.JSHost.ImportAsync
WebWorker
is un-managed resourceforceDisposeProxies
which is called at the end ofWebWorker
runFixes & tests
MONO_ENTER_GC_UNSAFE
/MONO_EXIT_GC_UNSAFE
intolifo-semaphore.c
callbacksMONO_ENTER_GC_UNSAFE
/MONO_EXIT_GC_UNSAFE
intomono_wasm_invoke_method_bound
mono_threads_wasm_on_thread_detached
callback for easier tracking of web workersset_thread_info
which creates functionglobalThis.monoThreadInfo
on the worker. It's easy to look at in the browser dev tools. Just in debug build of the runtime.Module.safeSetTimeout
for jobsbrowser-threads-minimal
SystemNative_GetCpuUtilization
Next
WebWorker
API is just early sketch. Do we want to make itIDisposable
instance instead ?WebWorker.Run
, maybe with a flag parameterforceDisposeProxies