Use rustc_thread_pool instead of rustc-rayon-core
This commit is contained in:
parent
0b9b1df006
commit
4aa62ea9e9
29 changed files with 86 additions and 81 deletions
39
Cargo.lock
39
Cargo.lock
|
|
@ -2977,6 +2977,15 @@ dependencies = [
|
|||
"getrandom 0.3.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a"
|
||||
dependencies = [
|
||||
"rand_core 0.9.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xoshiro"
|
||||
version = "0.7.0"
|
||||
|
|
@ -3176,16 +3185,6 @@ dependencies = [
|
|||
"tikv-jemalloc-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-rayon-core"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f42932dcd3bcbe484b38a3ccf79b7906fac41c02d408b5b1bac26da3416efdb"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-semver"
|
||||
version = "1.1.0"
|
||||
|
|
@ -3554,7 +3553,6 @@ dependencies = [
|
|||
"parking_lot",
|
||||
"portable-atomic",
|
||||
"rustc-hash 2.1.1",
|
||||
"rustc-rayon-core",
|
||||
"rustc-stable-hash",
|
||||
"rustc_arena",
|
||||
"rustc_graphviz",
|
||||
|
|
@ -3562,6 +3560,7 @@ dependencies = [
|
|||
"rustc_index",
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
"rustc_thread_pool",
|
||||
"smallvec",
|
||||
"stacker",
|
||||
"tempfile",
|
||||
|
|
@ -3908,7 +3907,6 @@ dependencies = [
|
|||
name = "rustc_interface"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"rustc-rayon-core",
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_ast_lowering",
|
||||
|
|
@ -3947,6 +3945,7 @@ dependencies = [
|
|||
"rustc_span",
|
||||
"rustc_symbol_mangling",
|
||||
"rustc_target",
|
||||
"rustc_thread_pool",
|
||||
"rustc_trait_selection",
|
||||
"rustc_traits",
|
||||
"rustc_ty_utils",
|
||||
|
|
@ -4074,7 +4073,6 @@ dependencies = [
|
|||
"either",
|
||||
"gsgdt",
|
||||
"polonius-engine",
|
||||
"rustc-rayon-core",
|
||||
"rustc_abi",
|
||||
"rustc_apfloat",
|
||||
"rustc_arena",
|
||||
|
|
@ -4098,6 +4096,7 @@ dependencies = [
|
|||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_target",
|
||||
"rustc_thread_pool",
|
||||
"rustc_type_ir",
|
||||
"smallvec",
|
||||
"thin-vec",
|
||||
|
|
@ -4344,7 +4343,6 @@ version = "0.0.0"
|
|||
dependencies = [
|
||||
"hashbrown",
|
||||
"parking_lot",
|
||||
"rustc-rayon-core",
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
"rustc_attr_data_structures",
|
||||
|
|
@ -4359,6 +4357,7 @@ dependencies = [
|
|||
"rustc_serialize",
|
||||
"rustc_session",
|
||||
"rustc_span",
|
||||
"rustc_thread_pool",
|
||||
"smallvec",
|
||||
"tracing",
|
||||
]
|
||||
|
|
@ -4520,6 +4519,18 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_thread_pool"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
"libc",
|
||||
"rand 0.9.1",
|
||||
"rand_xorshift",
|
||||
"scoped-tls",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_tools_util"
|
||||
version = "0.4.2"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ indexmap = "2.4.0"
|
|||
jobserver_crate = { version = "0.1.28", package = "jobserver" }
|
||||
measureme = "12.0.1"
|
||||
rustc-hash = "2.0.0"
|
||||
rustc-rayon-core = { version = "0.5.0" }
|
||||
rustc-stable-hash = { version = "0.1.0", features = ["nightly"] }
|
||||
rustc_arena = { path = "../rustc_arena" }
|
||||
rustc_graphviz = { path = "../rustc_graphviz" }
|
||||
|
|
@ -22,6 +21,7 @@ rustc_hashes = { path = "../rustc_hashes" }
|
|||
rustc_index = { path = "../rustc_index", package = "rustc_index" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_thread_pool = { path = "../rustc_thread_pool" }
|
||||
smallvec = { version = "1.8.1", features = ["const_generics", "union", "may_dangle"] }
|
||||
stacker = "0.1.17"
|
||||
tempfile = "3.2"
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//! | `RwLock<T>` | `RefCell<T>` | `parking_lot::RwLock<T>` |
|
||||
//! | `MTLock<T>` [^1] | `T` | `Lock<T>` |
|
||||
//! | | | |
|
||||
//! | `ParallelIterator` | `Iterator` | `rayon::iter::ParallelIterator` |
|
||||
//! | `ParallelIterator` | `Iterator` | `rustc_thread_pool::iter::ParallelIterator` |
|
||||
//!
|
||||
//! [^1]: `MTLock` is similar to `Lock`, but the serial version avoids the cost
|
||||
//! of a `RefCell`. This is appropriate when interior mutability is not
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ macro_rules! parallel {
|
|||
pub fn spawn(func: impl FnOnce() + DynSend + 'static) {
|
||||
if mode::is_dyn_thread_safe() {
|
||||
let func = FromDyn::from(func);
|
||||
rayon_core::spawn(|| {
|
||||
rustc_thread_pool::spawn(|| {
|
||||
(func.into_inner())();
|
||||
});
|
||||
} else {
|
||||
|
|
@ -107,11 +107,11 @@ pub fn spawn(func: impl FnOnce() + DynSend + 'static) {
|
|||
// This function only works when `mode::is_dyn_thread_safe()`.
|
||||
pub fn scope<'scope, OP, R>(op: OP) -> R
|
||||
where
|
||||
OP: FnOnce(&rayon_core::Scope<'scope>) -> R + DynSend,
|
||||
OP: FnOnce(&rustc_thread_pool::Scope<'scope>) -> R + DynSend,
|
||||
R: DynSend,
|
||||
{
|
||||
let op = FromDyn::from(op);
|
||||
rayon_core::scope(|s| FromDyn::from(op.into_inner()(s))).into_inner()
|
||||
rustc_thread_pool::scope(|s| FromDyn::from(op.into_inner()(s))).into_inner()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
@ -124,7 +124,7 @@ where
|
|||
let oper_a = FromDyn::from(oper_a);
|
||||
let oper_b = FromDyn::from(oper_b);
|
||||
let (a, b) = parallel_guard(|guard| {
|
||||
rayon_core::join(
|
||||
rustc_thread_pool::join(
|
||||
move || guard.run(move || FromDyn::from(oper_a.into_inner()())),
|
||||
move || guard.run(move || FromDyn::from(oper_b.into_inner()())),
|
||||
)
|
||||
|
|
@ -158,7 +158,7 @@ fn par_slice<I: DynSend>(
|
|||
let (left, right) = items.split_at_mut(items.len() / 2);
|
||||
let mut left = state.for_each.derive(left);
|
||||
let mut right = state.for_each.derive(right);
|
||||
rayon_core::join(move || par_rec(*left, state), move || par_rec(*right, state));
|
||||
rustc_thread_pool::join(move || par_rec(*left, state), move || par_rec(*right, state));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ pub fn par_map<I: DynSend, T: IntoIterator<Item = I>, R: DynSend, C: FromIterato
|
|||
pub fn broadcast<R: DynSend>(op: impl Fn(usize) -> R + DynSync) -> Vec<R> {
|
||||
if mode::is_dyn_thread_safe() {
|
||||
let op = FromDyn::from(op);
|
||||
let results = rayon_core::broadcast(|context| op.derive(op(context.index())));
|
||||
let results = rustc_thread_pool::broadcast(|context| op.derive(op(context.index())));
|
||||
results.into_iter().map(|r| r.into_inner()).collect()
|
||||
} else {
|
||||
vec![op(0)]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ edition = "2024"
|
|||
|
||||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
rustc-rayon-core = { version = "0.5.0" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
|
||||
rustc_ast_passes = { path = "../rustc_ast_passes" }
|
||||
|
|
@ -43,6 +42,7 @@ rustc_session = { path = "../rustc_session" }
|
|||
rustc_span = { path = "../rustc_span" }
|
||||
rustc_symbol_mangling = { path = "../rustc_symbol_mangling" }
|
||||
rustc_target = { path = "../rustc_target" }
|
||||
rustc_thread_pool = { path = "../rustc_thread_pool" }
|
||||
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
||||
rustc_traits = { path = "../rustc_traits" }
|
||||
rustc_ty_utils = { path = "../rustc_ty_utils" }
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
|
|||
|
||||
let proxy_ = Arc::clone(&proxy);
|
||||
let proxy__ = Arc::clone(&proxy);
|
||||
let builder = rayon_core::ThreadPoolBuilder::new()
|
||||
let builder = rustc_thread_pool::ThreadPoolBuilder::new()
|
||||
.thread_name(|_| "rustc".to_string())
|
||||
.acquire_thread_handler(move || proxy_.acquire_thread())
|
||||
.release_thread_handler(move || proxy__.release_thread())
|
||||
|
|
@ -218,7 +218,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
|
|||
// locals to it. The new thread runs the deadlock handler.
|
||||
|
||||
let current_gcx2 = current_gcx2.clone();
|
||||
let registry = rayon_core::Registry::current();
|
||||
let registry = rustc_thread_pool::Registry::current();
|
||||
let session_globals = rustc_span::with_session_globals(|session_globals| {
|
||||
session_globals as *const SessionGlobals as usize
|
||||
});
|
||||
|
|
@ -265,7 +265,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
|
|||
builder
|
||||
.build_scoped(
|
||||
// Initialize each new worker thread when created.
|
||||
move |thread: rayon_core::ThreadBuilder| {
|
||||
move |thread: rustc_thread_pool::ThreadBuilder| {
|
||||
// Register the thread for use with the `WorkerLocal` type.
|
||||
registry.register();
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ pub(crate) fn run_in_thread_pool_with_globals<
|
|||
})
|
||||
},
|
||||
// Run `f` on the first thread in the thread pool.
|
||||
move |pool: &rayon_core::ThreadPool| {
|
||||
move |pool: &rustc_thread_pool::ThreadPool| {
|
||||
pool.install(|| f(current_gcx.into_inner(), proxy))
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ bitflags = "2.4.1"
|
|||
either = "1.5.0"
|
||||
gsgdt = "0.1.2"
|
||||
polonius-engine = "0.13.0"
|
||||
rustc-rayon-core = { version = "0.5.0" }
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_apfloat = "0.2.0"
|
||||
rustc_arena = { path = "../rustc_arena" }
|
||||
|
|
@ -33,6 +32,7 @@ rustc_serialize = { path = "../rustc_serialize" }
|
|||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
rustc_target = { path = "../rustc_target" }
|
||||
rustc_thread_pool = { path = "../rustc_thread_pool" }
|
||||
rustc_type_ir = { path = "../rustc_type_ir" }
|
||||
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
||||
thin-vec = "0.2.12"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ impl<'a, 'tcx> ImplicitCtxt<'a, 'tcx> {
|
|||
}
|
||||
|
||||
// Import the thread-local variable from Rayon, which is preserved for Rayon jobs.
|
||||
use rayon_core::tlv::TLV;
|
||||
use rustc_thread_pool::tlv::TLV;
|
||||
|
||||
#[inline]
|
||||
fn erase(context: &ImplicitCtxt<'_, '_>) -> *const () {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ edition = "2024"
|
|||
[dependencies]
|
||||
# tidy-alphabetical-start
|
||||
parking_lot = "0.12"
|
||||
rustc-rayon-core = { version = "0.5.0" }
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
|
||||
|
|
@ -21,6 +20,7 @@ rustc_macros = { path = "../rustc_macros" }
|
|||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
rustc_thread_pool = { path = "../rustc_thread_pool" }
|
||||
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
||||
tracing = "0.1"
|
||||
# tidy-alphabetical-end
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ impl<I> QueryLatch<I> {
|
|||
// If this detects a deadlock and the deadlock handler wants to resume this thread
|
||||
// we have to be in the `wait` call. This is ensured by the deadlock handler
|
||||
// getting the self.info lock.
|
||||
rayon_core::mark_blocked();
|
||||
rustc_thread_pool::mark_blocked();
|
||||
let proxy = qcx.jobserver_proxy();
|
||||
proxy.release_thread();
|
||||
waiter.condvar.wait(&mut info);
|
||||
|
|
@ -251,9 +251,9 @@ impl<I> QueryLatch<I> {
|
|||
let mut info = self.info.lock();
|
||||
debug_assert!(!info.complete);
|
||||
info.complete = true;
|
||||
let registry = rayon_core::Registry::current();
|
||||
let registry = rustc_thread_pool::Registry::current();
|
||||
for waiter in info.waiters.drain(..) {
|
||||
rayon_core::mark_unblocked(®istry);
|
||||
rustc_thread_pool::mark_unblocked(®istry);
|
||||
waiter.condvar.notify_one();
|
||||
}
|
||||
}
|
||||
|
|
@ -507,7 +507,7 @@ fn remove_cycle<I: Clone>(
|
|||
/// all active queries for cycles before finally resuming all the waiters at once.
|
||||
pub fn break_query_cycles<I: Clone + Debug>(
|
||||
query_map: QueryMap<I>,
|
||||
registry: &rayon_core::Registry,
|
||||
registry: &rustc_thread_pool::Registry,
|
||||
) {
|
||||
let mut wakelist = Vec::new();
|
||||
// It is OK per the comments:
|
||||
|
|
@ -543,7 +543,7 @@ pub fn break_query_cycles<I: Clone + Debug>(
|
|||
// we wake the threads up as otherwise Rayon could detect a deadlock if a thread we
|
||||
// resumed fell asleep and this thread had yet to mark the remaining threads as unblocked.
|
||||
for _ in 0..wakelist.len() {
|
||||
rayon_core::mark_unblocked(registry);
|
||||
rustc_thread_pool::mark_unblocked(registry);
|
||||
}
|
||||
|
||||
for waiter in wakelist.into_iter() {
|
||||
|
|
|
|||
|
|
@ -1,25 +1,19 @@
|
|||
[package]
|
||||
name = "rustc-rayon-core"
|
||||
version = "0.5.1"
|
||||
name = "rustc_thread_pool"
|
||||
version = "0.0.0"
|
||||
authors = ["Niko Matsakis <niko@alum.mit.edu>",
|
||||
"Josh Stone <cuviper@gmail.com>"]
|
||||
description = "Core APIs for Rayon - fork for rustc"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-lang/rustc-rayon"
|
||||
documentation = "https://docs.rs/rustc-rayon-core/"
|
||||
rust-version = "1.63"
|
||||
edition = "2021"
|
||||
readme = "README.md"
|
||||
keywords = ["parallel", "thread", "concurrency", "join", "performance"]
|
||||
categories = ["concurrency"]
|
||||
|
||||
[lib]
|
||||
name = "rayon_core"
|
||||
|
||||
# Some dependencies may not be their latest version, in order to support older rustc.
|
||||
[dependencies]
|
||||
crossbeam-deque = "0.8.1"
|
||||
crossbeam-utils = "0.8.0"
|
||||
crossbeam-deque = "0.8"
|
||||
crossbeam-utils = "0.8"
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.9"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
|
|||
|
||||
let mid = partition(v);
|
||||
let (lo, _hi) = v.split_at_mut(mid);
|
||||
rayon_core::join(|| quick_sort(lo), || quick_sort(lo)); //~ ERROR
|
||||
rustc_thred_pool::join(|| quick_sort(lo), || quick_sort(lo)); //~ ERROR
|
||||
}
|
||||
|
||||
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
|
|||
|
||||
let mid = partition(v);
|
||||
let (lo, _hi) = v.split_at_mut(mid);
|
||||
rayon_core::join(|| quick_sort(lo), || quick_sort(v)); //~ ERROR
|
||||
rustc_thred_pool::join(|| quick_sort(lo), || quick_sort(v)); //~ ERROR
|
||||
}
|
||||
|
||||
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ fn quick_sort<T:PartialOrd+Send>(v: &mut [T]) {
|
|||
|
||||
let mid = partition(v);
|
||||
let (_lo, hi) = v.split_at_mut(mid);
|
||||
rayon_core::join(|| quick_sort(hi), || quick_sort(hi)); //~ ERROR
|
||||
rustc_thred_pool::join(|| quick_sort(hi), || quick_sort(hi)); //~ ERROR
|
||||
}
|
||||
|
||||
fn partition<T:PartialOrd+Send>(v: &mut [T]) -> usize {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::rc::Rc;
|
||||
|
||||
rayon_core::join(|| Rc::new(22), || ()); //~ ERROR
|
||||
rustc_thred_pool::join(|| Rc::new(22), || ()); //~ ERROR
|
||||
|
||||
``` */
|
||||
mod left {}
|
||||
|
|
@ -11,7 +11,7 @@ mod left {}
|
|||
|
||||
use std::rc::Rc;
|
||||
|
||||
rayon_core::join(|| (), || Rc::new(23)); //~ ERROR
|
||||
rustc_thred_pool::join(|| (), || Rc::new(23)); //~ ERROR
|
||||
|
||||
``` */
|
||||
mod right {}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use std::rc::Rc;
|
||||
|
||||
let r = Rc::new(22);
|
||||
rayon_core::join(|| r.clone(), || r.clone());
|
||||
rustc_thred_pool::join(|| r.clone(), || r.clone());
|
||||
//~^ ERROR
|
||||
|
||||
``` */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
fn bad_scope<F>(f: F)
|
||||
where F: FnOnce(&i32) + Send,
|
||||
{
|
||||
rayon_core::scope(|s| {
|
||||
rustc_thred_pool::scope(|s| {
|
||||
let x = 22;
|
||||
s.spawn(|_| f(&x)); //~ ERROR `x` does not live long enough
|
||||
});
|
||||
|
|
@ -13,7 +13,7 @@ fn good_scope<F>(f: F)
|
|||
where F: FnOnce(&i32) + Send,
|
||||
{
|
||||
let x = 22;
|
||||
rayon_core::scope(|s| {
|
||||
rustc_thred_pool::scope(|s| {
|
||||
s.spawn(|_| f(&x));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ mod test;
|
|||
/// [the `par_sort` method]: ../rayon/slice/trait.ParallelSliceMut.html#method.par_sort
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// let mut v = vec![5, 1, 8, 22, 0, 44];
|
||||
/// quick_sort(&mut v);
|
||||
/// assert_eq!(v, vec![0, 1, 5, 8, 22, 44]);
|
||||
|
|
|
|||
|
|
@ -152,14 +152,14 @@ enum ErrorKind {
|
|||
/// The following creates a thread pool with 22 threads.
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// let pool = rayon::ThreadPoolBuilder::new().num_threads(22).build().unwrap();
|
||||
/// ```
|
||||
///
|
||||
/// To instead configure the global thread pool, use [`build_global()`]:
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// rayon::ThreadPoolBuilder::new().num_threads(22).build_global().unwrap();
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -315,7 +315,7 @@ impl ThreadPoolBuilder {
|
|||
/// A scoped pool may be useful in combination with scoped thread-local variables.
|
||||
///
|
||||
/// ```
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
///
|
||||
/// scoped_tls::scoped_thread_local!(static POOL_DATA: Vec<i32>);
|
||||
///
|
||||
|
|
@ -382,7 +382,7 @@ impl<S> ThreadPoolBuilder<S> {
|
|||
/// A minimal spawn handler just needs to call `run()` from an independent thread.
|
||||
///
|
||||
/// ```
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// fn main() -> Result<(), rayon::ThreadPoolBuildError> {
|
||||
/// let pool = rayon::ThreadPoolBuilder::new()
|
||||
/// .spawn_handler(|thread| {
|
||||
|
|
@ -400,7 +400,7 @@ impl<S> ThreadPoolBuilder<S> {
|
|||
/// any errors from the thread builder.
|
||||
///
|
||||
/// ```
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// fn main() -> Result<(), rayon::ThreadPoolBuildError> {
|
||||
/// let pool = rayon::ThreadPoolBuilder::new()
|
||||
/// .spawn_handler(|thread| {
|
||||
|
|
@ -429,7 +429,7 @@ impl<S> ThreadPoolBuilder<S> {
|
|||
/// [`std::thread::scope`]: https://doc.rust-lang.org/std/thread/fn.scope.html
|
||||
///
|
||||
/// ```
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// fn main() -> Result<(), rayon::ThreadPoolBuildError> {
|
||||
/// std::thread::scope(|scope| {
|
||||
/// let pool = rayon::ThreadPoolBuilder::new()
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ struct ScopeBase<'scope> {
|
|||
/// it would be less efficient than the real implementation:
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// pub fn join<A,B,RA,RB>(oper_a: A, oper_b: B) -> (RA, RB)
|
||||
/// where A: FnOnce() -> RA + Send,
|
||||
/// B: FnOnce() -> RB + Send,
|
||||
|
|
@ -125,7 +125,7 @@ struct ScopeBase<'scope> {
|
|||
/// To see how and when tasks are joined, consider this example:
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// // point start
|
||||
/// rayon::scope(|s| {
|
||||
/// s.spawn(|s| { // task s.1
|
||||
|
|
@ -193,7 +193,7 @@ struct ScopeBase<'scope> {
|
|||
/// spawned task.
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// let ok: Vec<i32> = vec![1, 2, 3];
|
||||
/// rayon::scope(|s| {
|
||||
/// let bad: Vec<i32> = vec![4, 5, 6];
|
||||
|
|
@ -217,7 +217,7 @@ struct ScopeBase<'scope> {
|
|||
/// in this case including both `ok` *and* `bad`:
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// let ok: Vec<i32> = vec![1, 2, 3];
|
||||
/// rayon::scope(|s| {
|
||||
/// let bad: Vec<i32> = vec![4, 5, 6];
|
||||
|
|
@ -238,7 +238,7 @@ struct ScopeBase<'scope> {
|
|||
/// is a borrow of `ok` and capture *that*:
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// let ok: Vec<i32> = vec![1, 2, 3];
|
||||
/// rayon::scope(|s| {
|
||||
/// let bad: Vec<i32> = vec![4, 5, 6];
|
||||
|
|
@ -260,7 +260,7 @@ struct ScopeBase<'scope> {
|
|||
/// of individual variables:
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// let ok: Vec<i32> = vec![1, 2, 3];
|
||||
/// rayon::scope(|s| {
|
||||
/// let bad: Vec<i32> = vec![4, 5, 6];
|
||||
|
|
@ -312,7 +312,7 @@ where
|
|||
/// [`scope()`]: fn.scope.html
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// // point start
|
||||
/// rayon::scope_fifo(|s| {
|
||||
/// s.spawn_fifo(|s| { // task s.1
|
||||
|
|
@ -487,7 +487,7 @@ impl<'scope> Scope<'scope> {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// let mut value_a = None;
|
||||
/// let mut value_b = None;
|
||||
/// let mut value_c = None;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ use crate::unwind;
|
|||
/// This code creates a Rayon task that increments a global counter.
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
||||
///
|
||||
/// static GLOBAL_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ mod test;
|
|||
/// ## Creating a ThreadPool
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// let pool = rayon::ThreadPoolBuilder::new().num_threads(8).build().unwrap();
|
||||
/// ```
|
||||
///
|
||||
|
|
@ -88,10 +88,10 @@ impl ThreadPool {
|
|||
/// meantime. For example
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// fn main() {
|
||||
/// rayon::ThreadPoolBuilder::new().num_threads(1).build_global().unwrap();
|
||||
/// let pool = rayon_core::ThreadPoolBuilder::default().build().unwrap();
|
||||
/// let pool = rustc_thred_pool::ThreadPoolBuilder::default().build().unwrap();
|
||||
/// let do_it = || {
|
||||
/// print!("one ");
|
||||
/// pool.install(||{});
|
||||
|
|
@ -123,7 +123,7 @@ impl ThreadPool {
|
|||
/// ## Using `install()`
|
||||
///
|
||||
/// ```rust
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// fn main() {
|
||||
/// let pool = rayon::ThreadPoolBuilder::new().num_threads(8).build().unwrap();
|
||||
/// let n = pool.install(|| fib(20));
|
||||
|
|
@ -172,7 +172,7 @@ impl ThreadPool {
|
|||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use rayon_core as rayon;
|
||||
/// # use rustc_thred_pool as rayon;
|
||||
/// use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
///
|
||||
/// fn main() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use std::error::Error;
|
||||
|
||||
use rayon_core::ThreadPoolBuilder;
|
||||
use rustc_thred_pool::ThreadPoolBuilder;
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use rayon_core::ThreadPoolBuilder;
|
||||
use rustc_thred_pool::ThreadPoolBuilder;
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(any(target_os = "emscripten", target_family = "wasm"), ignore)]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ where
|
|||
F: FnOnce() + Send,
|
||||
G: FnOnce() + Send,
|
||||
{
|
||||
rayon_core::scope(|s| {
|
||||
rustc_thred_pool::scope(|s| {
|
||||
s.spawn(|_| g());
|
||||
f();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crossbeam_utils::thread;
|
||||
use rayon_core::ThreadPoolBuilder;
|
||||
use rustc_thred_pool::ThreadPoolBuilder;
|
||||
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
struct Local(i32);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use rayon_core::join;
|
||||
use rustc_thred_pool::join;
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "should panic")]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use std::env;
|
|||
use std::os::unix::process::ExitStatusExt;
|
||||
use std::process::{Command, ExitStatus, Stdio};
|
||||
|
||||
use rayon_core::ThreadPoolBuilder;
|
||||
use rustc_thred_pool::ThreadPoolBuilder;
|
||||
|
||||
fn force_stack_overflow(depth: u32) {
|
||||
let mut buffer = [0u8; 1024 * 1024];
|
||||
|
|
|
|||
|
|
@ -356,6 +356,7 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
|
|||
"rand",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_xorshift", // dependency for doc-tests in rustc_thread_pool
|
||||
"rand_xoshiro",
|
||||
"redox_syscall",
|
||||
"regex",
|
||||
|
|
@ -364,7 +365,6 @@ const PERMITTED_RUSTC_DEPENDENCIES: &[&str] = &[
|
|||
"rustc-demangle",
|
||||
"rustc-hash",
|
||||
"rustc-literal-escaper",
|
||||
"rustc-rayon-core",
|
||||
"rustc-stable-hash",
|
||||
"rustc_apfloat",
|
||||
"rustix",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue