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

Function handleAsyncFunction

src/jsifier.mjs:362–378  ·  view source on GitHub ↗
(snippet, sig)

Source from the content-addressed store, hash-verified

360}
361
362function handleAsyncFunction(snippet, sig) {
363 const return64 = sig && (MEMORY64 && sig.startsWith('p') || sig.startsWith('j'))
364 let handleAsync = 'Asyncify.handleAsync(innerFunc)'
365 if (return64 && ASYNCIFY == 1) {
366 handleAsync = makeReturn64(handleAsync);
367 }
368 return modifyJSFunction(snippet, (args, body, async_, oneliner) => {
369 if (!oneliner) {
370 body = `{\n${body}\n}`;
371 }
372 return `\
373function(${args}) {
374 let innerFunc = ${async_} () => ${body};
375 return ${handleAsync};
376}\n`;
377 });
378}
379
380// The three different inter-thread proxying methods.
381// See system/lib/pthread/proxying.c

Callers 1

processLibraryFunctionFunction · 0.85

Calls 2

makeReturn64Function · 0.90
modifyJSFunctionFunction · 0.90

Tested by

no test coverage detected