Skip to content

Fix emrun_file_dump() to work in multithreaded builds.#26698

Open
juj wants to merge 1 commit intoemscripten-core:mainfrom
juj:fix_emrun_file_dump_with_threads
Open

Fix emrun_file_dump() to work in multithreaded builds.#26698
juj wants to merge 1 commit intoemscripten-core:mainfrom
juj:fix_emrun_file_dump_with_threads

Conversation

@juj
Copy link
Copy Markdown
Collaborator

@juj juj commented Apr 16, 2026

No description provided.

Comment thread test/test_browser.py
self.assertContained('remember to add `--` between arguments', err)

@also_with_threads
def test_emrun(self):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC we are not actually running these tests in CI since they got disabled a while back.

See #26182

We should certain look into fixing that.

Comment thread src/emrun_postjs.js
http.open("POST", "stdio.html?file=" + filename, true);
http.send(data); // XXX this does not work in workers, for some odd reason (issue #2681)
if (ArrayBuffer.isView(data) && typeof SharedArrayBuffer !== "undefined" && data.buffer instanceof SharedArrayBuffer) {
http.send(new data.constructor(data)); // Make a clone of the typed array of the same type, since http.send() does not allow SharedArrayBuffer backing.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just always go this. Its such a rare opertaion?\

Or at least do

if (.. ) {
   data = new data.constructor(data);
}
http.send(data);

Comment thread src/emrun_postjs.js
out(`Dumping out file "${filename}" with ${data.length} bytes of data.`);
http.open("POST", "stdio.html?file=" + filename, true);
http.send(data); // XXX this does not work in workers, for some odd reason (issue #2681)
if (ArrayBuffer.isView(data) && typeof SharedArrayBuffer !== "undefined" && data.buffer instanceof SharedArrayBuffer) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It you look at getUnsharedTextDecoderView I think we can replace this whole expression with just !(data.buffer instanceof ArrayBuffer)

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented Apr 16, 2026

Re the code size failures, here was an update that happened overnight. If you rebase that should now be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants