If you want threads you will need to either run under Node or in the
browser.  Emscripten only has support for Node workers and Web workers.

If you want a version of node that has the very latest version of v8 you
can use the node-canary releases: https://nodejs.org/download/v8-canary/

cheers,
sam

On Tue, Dec 10, 2024 at 8:41 AM guest271314 <[email protected]> wrote:

> I think Worker in d8 is implemented different from Worker in a browser.
>
> On Thu, Dec 5, 2024 at 9:32 PM Keith Teo <[email protected]> wrote:
>
>> Hi,
>>
>> I am trying to benchmark the effects of modifications to various parts of
>> the WASM toolchain. But when running multithreaded emscripten output in d8
>> I get the error:
>>
>> Aborted(Assertion failed: Pthreads do not work in this environment yet
>> (need Web Workers, or an alternative to them))
>> test.js:731: RuntimeError: Aborted(Assertion failed: Pthreads do not work
>> in this environment yet (need Web Workers, or an alternative to them))
>>   throw e;
>>
>> The error comes from this line:
>>
>> assert(
>>   ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER || ENVIRONMENT_IS_NODE,
>> 'Pthreads do not work in this environment yet (need Web Workers, or an
>> alternative to them)');
>>
>> Anyone know how to get around this? d8 is capable of running web workers,
>> so there's no technical limitation on it.
>>
>> This is how I compiled my cpp code
>>
>> em++ -sENVIRONMENT=shell,worker -s ASSERTIONS=2 -s PTHREAD_POOL_SIZE=4 -s
>> WASM=1 -pthread test.cpp -o test.js
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion visit
>> https://groups.google.com/d/msgid/emscripten-discuss/2e776c13-a1bb-4479-9091-b62ebc49e22bn%40googlegroups.com
>> <https://groups.google.com/d/msgid/emscripten-discuss/2e776c13-a1bb-4479-9091-b62ebc49e22bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/emscripten-discuss/CA%2BsyWANGFNy%3DaLL4CY_BPPGfUtUsJntwSX2iRdQVDwEsCBUXFQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/emscripten-discuss/CA%2BsyWANGFNy%3DaLL4CY_BPPGfUtUsJntwSX2iRdQVDwEsCBUXFQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2-p7T-sdV-y4JyRoo78V%2BD_a8tMMq9Dp2WvKs7Bf1xHRg%40mail.gmail.com.

Reply via email to