Skip to content

Commit

Permalink
Clarify cfg(send_sync) gating in this backend/webgpu comment. (#6274)
Browse files Browse the repository at this point in the history
Addresses the confusion in #6267.
  • Loading branch information
BGR360 committed Sep 15, 2024
1 parent eb18854 commit a21c0e2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions wgpu/src/backend/webgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ use crate::{
// implement `Send` and `Sync` to match native.
//
// SAFETY: All webgpu handle types in wasm32 are internally a `JsValue`, and `JsValue` is neither
// Send nor Sync. Currently, wasm32 has no threading support so implementing `Send` or `Sync` for a
// type is (for now) harmless. Eventually wasm32 will support threading, and depending on how this
// is integrated (or not integrated) with values like those in webgpu, this may become unsound.
// Send nor Sync. Currently, wasm32 has no threading support by default, so implementing `Send` or
// `Sync` for a type is harmless. However, nightly Rust supports compiling wasm with experimental
// threading support via `--target-features`. If `wgpu` is being compiled with those features, we do
// not implement `Send` and `Sync` on the webgpu handle types.

#[derive(Clone, Debug)]
pub(crate) struct Sendable<T>(T);
Expand Down

0 comments on commit a21c0e2

Please sign in to comment.