-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat: port libuv threadpool #9
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b8535be
feat: add `EMNAPI_WORKER_POOL_SIZE` to limit max parallel async work …
toyobayashi 54ad540
refactor: do not override array built-in methods
toyobayashi 966d0c1
test: EMNAPI_WORKER_POOL_SIZE=2
toyobayashi a27ca83
feat: port libuv threadpool
toyobayashi 653b953
refactor: use `calloc` and add `uv_req_t` type
toyobayashi e6813ba
fix: ensure callback call in main thread
toyobayashi ceb1b65
feat: `EMNAPI_ASYNC_SEND_TYPE`
toyobayashi 72b3fb7
test: MAIN_THREAD_ASYNC_EM_ASM
toyobayashi c5c26f9
doc: readme
toyobayashi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
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.
@RReverser I left comments here. If you prefer that emnapi should not depend on
PThread
object, I would appreciate it if you could open another PR to provide help. Sorry for my broken English, forget it if there is some strange or offensive expression.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.
@RReverser c3a3cdb1 At last I found
emscripten_proxy_async
andem_proxying_queue_create
works well, but usingemscripten_proxy_get_system_queue()
will also stuck if call printf in child thread. I could not figure out why.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.
Heh unfortunately I'm finding a bit hard to follow how threading works in this library, so not sure I can submit a PR for that yet.
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.
FWIW one other reason I want it to have its own pool of workers is that upstream there are talks of making it possible to use pthreads without a pthread pool, and I now have a working implementation of that at least for Node.js.
However, it seems that emnapi won't work with that approach in the current form since it manipulates internal arrays and waits until
unusedWorkers
is not empty. But, if Emscripten will use pthreads without a pthread pool, it will be empty at the start so emnapi will wait forever.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.
Ah, looks like I had a slightly outdated dist version and you already removed some more usages. This is looking promising, going to give it a try with the pool-less version of Emscripten.