Home / Function/ new_for_each_thread() — tailwindcss Function Reference

new_for_each_thread() — tailwindcss Function Reference

Architecture documentation for the new_for_each_thread() function in walk.rs from the tailwindcss codebase.

Function rust RustCore MachineExtractor calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  89168aff_5361_e310_017c_2b23f665da52["new_for_each_thread()"]
  c86808e9_e9bf_ba3a_5066_e8e86b62e340["visit()"]
  c86808e9_e9bf_ba3a_5066_e8e86b62e340 -->|calls| 89168aff_5361_e310_017c_2b23f665da52
  2fcdc00d_9979_79c1_5408_d697c67c1905["push()"]
  89168aff_5361_e310_017c_2b23f665da52 -->|calls| 2fcdc00d_9979_79c1_5408_d697c67c1905
  style 89168aff_5361_e310_017c_2b23f665da52 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

Calls

Called By

Frequently Asked Questions

What does new_for_each_thread() do?
new_for_each_thread() is a function in the tailwindcss codebase.
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