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
16 changes: 8 additions & 8 deletions system/lib/html5/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typedef struct callback_args_t {
static void do_callback(void* arg) {
callback_args_t* args = (callback_args_t*)arg;
args->callback(args->event_type, args->event_data, args->user_data);
free(arg);
}

void _emscripten_run_callback_on_thread(pthread_t t,
Expand All @@ -29,14 +30,13 @@ void _emscripten_run_callback_on_thread(pthread_t t,
void* event_data,
void* user_data) {
em_proxying_queue* q = emscripten_proxy_get_system_queue();
callback_args_t arg = {
.callback = f,
.event_type = event_type,
.event_data = event_data,
.user_data = user_data,
};
callback_args_t* arg = malloc(sizeof(callback_args_t));
arg->callback = f;
arg->event_type = event_type;
arg->event_data = event_data;
arg->user_data = user_data;

if (!emscripten_proxy_sync(q, t, do_callback, &arg)) {
assert(false && "emscripten_proxy_sync failed");
if (!emscripten_proxy_async(q, t, do_callback, arg)) {
assert(false && "emscripten_proxy_async failed");
}
}
Loading