MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / malloc

Function malloc

test/pthread/test_pthread_proxy_deadlock.c:18–24  ·  view source on GitHub ↗

In the actual implementation of malloc the system queue may be executed non-deterministically if malloc is waiting on a mutex. This wraps malloc and executes the system queue during every allocation to make the behavior deterministic.

Source from the content-addressed store, hash-verified

16// executes the system queue during every allocation to make the behavior
17// deterministic.
18void *malloc(size_t size) {
19 if (emscripten_is_main_runtime_thread()) {
20 emscripten_proxy_execute_queue(emscripten_proxy_get_system_queue());
21 }
22 void *ptr = emscripten_builtin_malloc(size);
23 return ptr;
24}
25
26void task(void* arg) {
27 emscripten_out("task\n");

Callers 12

fFunction · 0.70
gFunction · 0.70
mainFunction · 0.70
thread_startFunction · 0.70
thread_startFunction · 0.70
thread_startFunction · 0.70
mainFunction · 0.70
gFunction · 0.70
mainFunction · 0.70
test_tasks_queue_growthFunction · 0.70

Tested by

no test coverage detected