enable thread safety for sbrk and emmalloc, when using WASM_WORKERS#18174
enable thread safety for sbrk and emmalloc, when using WASM_WORKERS#18174juj merged 4 commits intoemscripten-core:mainfrom
Conversation
system/lib/sbrk.c
Outdated
| #endif | ||
|
|
||
| #ifdef __EMSCRIPTEN_WASM_WORKERS__ | ||
| #define RETRY_SBRK 1 |
There was a problem hiding this comment.
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.
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.
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)