-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Split PortableThreadPool.WorkerThread start and loop body #84490
Split PortableThreadPool.WorkerThread start and loop body #84490
Conversation
For browser-wasm we will need to start the worker thread in a special way, and use callbacks to run the loop body. Current PR is just refactoring existing code. No functional change.
Tagging subscribers to this area: @mangod9 Issue DetailsThis is Part 1 of #84489 - landing support for async JS interop on threadpool threads in multi-threaded WebAssembly. We will need to start the threadpool worker threads on the browser in a special way, such that they can exit back to the JS event loop, and use callbacks to run the worker loop body. The current PR splits into a separate file the logic for starting threadpool worker threads, and the outer loop that waits for the semaphore that signals that work is available for the worker. The loop body (to be shared with the callback-based approach in a future PR) remains in Current PR is just refactoring existing code. No functional change.
|
@kouvel could you take a look |
threadAdjustmentLock.Release(); | ||
} | ||
// if we get here new work came in and we're going to keep running | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just return false instead of the break statement above
...es/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.NonBrowser.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of minor suggestions, otherwise LGTM
src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.WorkerThread.cs
Outdated
Show resolved
Hide resolved
Failure is #84979 |
This is Part 1 of #84489 - landing support for async JS interop on threadpool threads in multi-threaded WebAssembly.
We will need to start the threadpool worker threads on the browser in a special way, such that they can exit back to the JS event loop, and use callbacks to run the worker loop body.
The current PR splits into a separate file the logic for starting threadpool worker threads, and the outer loop that waits for the semaphore that signals that work is available for the worker. The loop body (to be shared with the callback-based approach in a future PR) remains in
PortableThreadPool.WorkerThread.cs
as several new toplevel functions.Current PR is just refactoring existing code. No functional change.