Repository navigation
Conversation
| } | ||
|
|
||
| int brk(intptr_t ptr) { | ||
| #if __EMSCRIPTEN_PTHREADS__ |
There was a problem hiding this comment.
I guess we could even make this work only on the main thread (but not background threads) if we wanted.
|
Edit: I was mistaken, see below comments. |
| #include <stddef.h> | ||
| #include <stdlib.h> | ||
| #include <stdint.h> | ||
| #include <stdio.h> |
There was a problem hiding this comment.
These newly added headers should probably also be behind an #if __EMSCRIPTEN_PTHREADS__.
|
|
|
Correct, our default malloc doesn't call brk, only sbrk. @VirtualTim This patch just avoids users having silent memory races or other issues, if they ship their own allocation code that does use brk, until we fix this properly. |
|
It is true that if the user ships a malloc that is threadsafe (like dlmalloc), and that does use brk, then this PR would make it fail. But we can't tell the custom allocator is safe. |
|
OK, I guess I misunderstood the impact. If this only affects brk called from user code then this change is good. |
emscripten-core#10008) See emscripten-core#10006 - this will at least get us a clear error from a user that hits this, until we fix the issue properly.
See #10006