Skip to content

Commit

Permalink
Make wasm_sync private dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
RReverser committed Jan 10, 2024
1 parent e4ac549 commit f11ca98
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ exclude = ["ci"]
[dependencies]
rayon-core = { version = "1.12.0", path = "rayon-core" }

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

# This is a public dependency!
[dependencies.either]
version = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions rayon-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ pub use self::thread_pool::{yield_local, yield_now, Yield};
target_os = "unknown",
target_feature = "atomics"
)))]
pub use std::sync;
use std::sync;

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

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

Expand Down
15 changes: 14 additions & 1 deletion src/iter/par_bridge.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
use rayon_core::sync::Mutex;
#[cfg(not(all(
target_arch = "wasm32",
target_os = "unknown",
target_feature = "atomics"
)))]
use std::sync::Mutex;

#[cfg(all(
target_arch = "wasm32",
target_os = "unknown",
target_feature = "atomics"
))]
use wasm_sync::Mutex;

use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};

use crate::iter::plumbing::{bridge_unindexed, Folder, UnindexedConsumer, UnindexedProducer};
Expand Down

0 comments on commit f11ca98

Please sign in to comment.