diff --git a/packages/native-core/Cargo.toml b/packages/native-core/Cargo.toml index e6b50b8a4..370e85d36 100644 --- a/packages/native-core/Cargo.toml +++ b/packages/native-core/Cargo.toml @@ -28,6 +28,8 @@ hashbrown = { version = "0.13.2", features = ["raw"] } # for parsing attributes lightningcss = "1.0.0-alpha.39" +rayon = "1.6.1" + [dev-dependencies] rand = "0.8.5" dioxus = { path = "../dioxus", version = "^0.3.0" } diff --git a/packages/native-core/src/passes.rs b/packages/native-core/src/passes.rs index c5de9f965..c6c212f5f 100644 --- a/packages/native-core/src/passes.rs +++ b/packages/native-core/src/passes.rs @@ -390,7 +390,7 @@ pub fn resolve_passes( while !pass_indexes_remaining.is_empty() { let mut currently_in_use = FxHashSet::::default(); let dynamically_borrowed_tree = tree.tree.dynamically_borrowed(); - std::thread::scope(|s| { + rayon::in_place_scope(|s| { let mut i = 0; while i < pass_indexes_remaining.len() { let passes_idx = pass_indexes_remaining[i]; @@ -414,7 +414,7 @@ pub fn resolve_passes( let dirty_nodes = dirty_nodes.clone(); let nodes_updated = nodes_updated.clone(); let ctx = ctx.clone(); - s.spawn(move || { + s.spawn(move |_| { pass.resolve(tree_view, &dirty_nodes, &nodes_updated, &ctx); }); } else {