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 50d8f66c_d9fa_4b09_e1eb_f4b8cd7772cd["new_for_each_thread()"] b3ca296d_790b_9bf3_23ea_56e5c5c48565["walk.rs"] 50d8f66c_d9fa_4b09_e1eb_f4b8cd7772cd -->|defined in| b3ca296d_790b_9bf3_23ea_56e5c5c48565 b2d9feab_5e1a_a1ee_dc95_cd3038d14bc7["visit()"] b2d9feab_5e1a_a1ee_dc95_cd3038d14bc7 -->|calls| 50d8f66c_d9fa_4b09_e1eb_f4b8cd7772cd ae599a85_0c60_15e1_b5ae_270bd089125f["push()"] 50d8f66c_d9fa_4b09_e1eb_f4b8cd7772cd -->|calls| ae599a85_0c60_15e1_b5ae_270bd089125f style 50d8f66c_d9fa_4b09_e1eb_f4b8cd7772cd 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