This is (potentially) great news; being able to test wasm-threads code via
d8 (rather than a full browser interaction) would make future Halide
support for threading much easier to support. But is this a deliberate,
long-term commitment on the part of V8 to provide enough WebWorker support
to support wasm threading? (We wouldn't entertain using this otherwise.)

On Tue, Jul 2, 2019 at 2:02 PM Alon Zakai <[email protected]> wrote:

> Thanks, I didn't know the V8 shell had this!
>
> After asking some people, it sounds like this can indeed be useful for us.
> It isn't intended to be identical to the Web API for Workers, but it is not
> a temporary API, so we can rely on it for testing.
>
>  -  I think we'd need to work around any API differences like that .data
> thing, by checking if we are in "ENVIRONMENT_IS_SHELL" etc.
>  - The synchronous getMessage is a special d8 extension, yeah - if it's
> useful for us then no reason not to use it (but yeah, such things are
> probably not well documented except in the source...).
>
> PR sounds great!
>
> - Alon
>
>
> On Sat, Jun 29, 2019 at 3:48 AM Zoltan Varga <[email protected]> wrote:
>
>> Hi,
>>
>>  It looks like recent versions of V8's JS shell support web workers, so
>> it is possible to run emscripten+pthreads in this shell. This is useful for
>> running test suites which
>> use threads as it requires less work than running in the browser.
>>
>> Ran into the following problems:
>> - the message received by onmessage () is not wrapped in a 'data'
>> property. This might be a bug in D8.
>> - the main threads onmessage () seems to be only called when control
>> returns to the main loop which never seems to happen in the JS shell, so
>> the 'loaded' message
>>   is never received by the main thread, so startup fails. Worked around
>> it by receiving the message synchronously using worker.getMessage () and
>> passing it to
>>   onmessage (). Couldn't find too much documentation on getMessage (), is
>> it a V8 extension ?
>>
>> Here is a commit with the changes:
>>
>> https://github.com/vargaz/emscripten/commit/99e8ab6fb5e2a46a880aebe30014f6065b1c1b35
>>
>> Wanted to discuss these isues before making it into a PR.
>>
>>                     Zoltan
>>
>>
>> --
>> 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 on the web visit
>> https://groups.google.com/d/msgid/emscripten-discuss/95c693a4-7d24-4e40-9bff-7ea1e960daa4%40googlegroups.com
>> <https://groups.google.com/d/msgid/emscripten-discuss/95c693a4-7d24-4e40-9bff-7ea1e960daa4%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpQukKgBZQ3eLFxH0UCNotCWQchQ7S6cgMXDLM_Tus4wwA%40mail.gmail.com
> <https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpQukKgBZQ3eLFxH0UCNotCWQchQ7S6cgMXDLM_Tus4wwA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAM%3DdnvdOyGe_tA7Zz9mbE9P0jBcJpdxiPpAkc9t63_fudKcqiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to