WebAssembly / shared-everything-threads

A draft proposal for spawning threads in WebAssembly
Other
29 stars 1 forks source link

Add Thread-Bound Data to the documented JS API #53

Closed tlively closed 1 month ago

tlively commented 2 months ago

As discussed in #30 and #37, add a JS API that allows arbitrary objects to be wrapped and converted to shared externrefs with dynamic checks ensuring the wrapped object is only ever observed on the original thread. Refer to the existing FAQ entry for discussion on how the lifetimes of the wrapper and wrapped object might interact.

Resolves #37.

tlively commented 2 months ago

cc @eqrion and @syg for comments as well.

tlively commented 2 months ago

Thank you both for the review. I've addressed all the feedback. I'll also add this as an agenda item for the next subgroup meeting.

tlively commented 2 months ago

The text here already includes "... assuming that browser GCs can support such an exception (see the discussion in the FAQ below)" so I think it's sufficiently clear that this is not set in stone and depends on architectural constraints from browsers.

abrown commented 2 months ago

Talked to @eqrion: he has opinions on this but is on leave for a few more weeks. Why don't we leave it open until he gets back?

eqrion commented 1 month ago

(sorry for the delay, just got back). My comment was only just ensuring that this is suitably marked as depending on browsers supporting shared-to-unshared references, which is an open question at this point. It looks like that's marked out well enough, so I think this can be merged.

tlively commented 1 month ago

Thanks, @eqrion! @abrown, want to flip the approve bit?