Skip to content

Ensure that JsValue isn't considered Send#955

Merged
alexcrichton merged 1 commit intowasm-bindgen:masterfrom
alexcrichton:non-send
Oct 11, 2018
Merged

Ensure that JsValue isn't considered Send#955
alexcrichton merged 1 commit intowasm-bindgen:masterfrom
alexcrichton:non-send

Conversation

@alexcrichton
Copy link
Copy Markdown
Contributor

The JsValue type wraps a slab/heap of js objects which is managed by
the wasm-bindgen shim, and everything here is not actually able to cross
any thread boundaries. When wasm actually has threads, for example, each
thread will have to have its own slab of objects generated by
wasm-bindgen, and indices in one slab aren't valid in any other slabs.

This is technically a breaking change because JsValue was previously
Send and Sync, but I'm hoping that in practice this isn't actually a
breaking change because nothing in wasm can be using threads which in
theory shouldn't activate the Send and/or Sync bounds.

The `JsValue` type wraps a slab/heap of js objects which is managed by
the wasm-bindgen shim, and everything here is not actually able to cross
any thread boundaries. When wasm actually has threads, for example, each
thread will have to have its own slab of objects generated by
wasm-bindgen, and indices in one slab aren't valid in any other slabs.

This is technically a breaking change because `JsValue` was previously
`Send` and `Sync`, but I'm hoping that in practice this isn't actually a
breaking change because nothing in wasm can be using threads which in
theory shouldn't activate the `Send` and/or `Sync` bounds.
Copy link
Copy Markdown
Contributor

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

yep

@alexcrichton alexcrichton merged commit e03e404 into wasm-bindgen:master Oct 11, 2018
@alexcrichton alexcrichton deleted the non-send branch October 11, 2018 00:52
@upsuper
Copy link
Copy Markdown

upsuper commented Jan 22, 2019

Well, it is a breaking change since it breaks the use of lazy_static :)

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.

3 participants