-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
enable thread safety for sbrk and emmalloc, when using WASM_WORKERS #18174
Conversation
system/lib/sbrk.c
Outdated
#endif | ||
|
||
#ifdef __EMSCRIPTEN_WASM_WORKERS__ | ||
#define RETRY_SBRK 1 |
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.
Combining these into a single block makes sense to me.
Also, perhaps instead of defined(__EMSCRIPTEN_PTHREADS__) || defined(__EMSCRIPTEN_WASM_WORKERS__)
you can just use ifdef __EMSCRIPTEN_SHARED_MEMORY__
? Or equivalently ifdef _REENDTRANT
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.
Hmm well, I suppose this could now just read #ifdef __EMSCRIPTEN_SHARED_MEMORY__
everywhere without introducing a RETRY_SBRK
define at all?
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, I had thought to keep it for the brevity (since EMSCRIPTEN_SHARED_MEMORY is kind of long), and maybe for future use. Anyway, changed to #ifdef __EMSCRIPTEN_SHARED_MEMORY__
as you suggested.
Ohh, good find there were missing shared paths. I think |
… use __EMSCRIPTEN_SHARED_MEMORY__ for shared pthread/wasm workers cases
Makes sense, changed to use #ifdef EMSCRIPTEN_SHARED_MEMORY . |
… remove redundant RETRY_SBRK
Great, thanks! |
This is a fix for the issue reported in PR #18171 .
More details in my comment on that PR:
#18171 (comment)