new_for_each_thread() — tailwindcss Function Reference
Architecture documentation for the new_for_each_thread() function in walk.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD c7517470_3fdb_c276_0548_e9d06fd24be6["new_for_each_thread()"] 8031325b_dcd2_8c49_70e7_46191ce03a79["walk.rs"] c7517470_3fdb_c276_0548_e9d06fd24be6 -->|defined in| 8031325b_dcd2_8c49_70e7_46191ce03a79 da7185cc_deeb_42bc_cc20_4a3139551ba0["visit()"] da7185cc_deeb_42bc_cc20_4a3139551ba0 -->|calls| c7517470_3fdb_c276_0548_e9d06fd24be6 9154c417_a5f7_3461_946b_605c083b3ec3["push()"] c7517470_3fdb_c276_0548_e9d06fd24be6 -->|calls| 9154c417_a5f7_3461_946b_605c083b3ec3 style c7517470_3fdb_c276_0548_e9d06fd24be6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
crates/ignore/src/walk.rs lines 1520–1547
fn new_for_each_thread(threads: usize, init: Vec<Message>) -> Vec<Stack> {
// Using new_lifo() ensures each worker operates depth-first, not
// breadth-first. We do depth-first because a breadth first traversal
// on wide directories with a lot of gitignores is disastrous (for
// example, searching a directory tree containing all of crates.io).
let deques: Vec<Deque<Message>> = std::iter::repeat_with(Deque::new_lifo)
.take(threads)
.collect();
let stealers =
Arc::<[Stealer<Message>]>::from(deques.iter().map(Deque::stealer).collect::<Vec<_>>());
let stacks: Vec<Stack> = deques
.into_iter()
.enumerate()
.map(|(index, deque)| Stack {
index,
deque,
stealers: stealers.clone(),
})
.collect();
// Distribute the initial messages, reverse the order to cancel out
// the other reversal caused by the inherent LIFO processing of the
// per-thread stacks which are filled here.
init.into_iter()
.rev()
.zip(stacks.iter().cycle())
.for_each(|(m, s)| s.push(m));
stacks
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does new_for_each_thread() do?
new_for_each_thread() is a function in the tailwindcss codebase, defined in crates/ignore/src/walk.rs.
Where is new_for_each_thread() defined?
new_for_each_thread() is defined in crates/ignore/src/walk.rs at line 1520.
What does new_for_each_thread() call?
new_for_each_thread() calls 1 function(s): push.
What calls new_for_each_thread()?
new_for_each_thread() is called by 1 function(s): visit.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free