Skip to content

Commit

Permalink
Only use wasm_sync if built with atomics
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Dec 25, 2023
1 parent f05faf6 commit 6a2f0c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rayon-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ categories = ["concurrency"]
crossbeam-deque = "0.8.1"
crossbeam-utils = "0.8.0"

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown", target_feature = "atomics"))'.dependencies]
wasm_sync = "0.1.0"

[dev-dependencies]
Expand Down
13 changes: 11 additions & 2 deletions rayon-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,18 @@ pub use self::thread_pool::current_thread_index;
pub use self::thread_pool::ThreadPool;
pub use self::thread_pool::{yield_local, yield_now, Yield};

#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
#[cfg(not(all(
target_arch = "wasm32",
target_os = "unknown",
target_feature = "atomics"
)))]
pub use std::sync;
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]

#[cfg(all(
target_arch = "wasm32",
target_os = "unknown",
target_feature = "atomics"
))]
pub use wasm_sync as sync;

use self::registry::{CustomSpawn, DefaultSpawn, ThreadSpawn};
Expand Down

0 comments on commit 6a2f0c9

Please sign in to comment.