Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions system/lib/pthread/proxying.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ static em_task_queue* get_or_add_tasks_for_thread(em_proxying_queue* q,
return tasks;
}

static _Thread_local bool executing_system_queue = false;

void emscripten_proxy_execute_queue(em_proxying_queue* q) {
assert(q != NULL);
assert(pthread_self());
Expand All @@ -114,13 +116,12 @@ void emscripten_proxy_execute_queue(em_proxying_queue* q) {
// pthread_lock call below that executes the system queue. The per-task_queue
// recursion lock can't catch these recursions because it can only be checked
// after the lock has been acquired.
static _Thread_local int executing_system_queue = 0;
int is_system_queue = q == &system_proxying_queue;
bool is_system_queue = q == &system_proxying_queue;
if (is_system_queue) {
if (executing_system_queue) {
return;
}
executing_system_queue = 1;
executing_system_queue = true;
}

pthread_mutex_lock(&q->mutex);
Expand All @@ -133,7 +134,7 @@ void emscripten_proxy_execute_queue(em_proxying_queue* q) {
}

if (is_system_queue) {
executing_system_queue = 0;
executing_system_queue = false;
}
}

Expand Down Expand Up @@ -607,7 +608,7 @@ double _emscripten_run_on_main_thread_js(int func_index,
void* em_asm_addr,
int num_args,
double* buffer,
int sync) {
bool sync) {
Comment thread
sbc100 marked this conversation as resolved.
proxied_js_func_t f = {
.funcIndex = func_index,
.emAsmAddr = em_asm_addr,
Expand Down