Home / Function/ get_work() — tailwindcss Function Reference

get_work() — tailwindcss Function Reference

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

Function rust Oxide Scanner calls 5 called by 1

Entity Profile

Dependency Diagram

graph TD
  c5b4d030_44f4_60f6_27d3_745efbd9bf88["get_work()"]
  8031325b_dcd2_8c49_70e7_46191ce03a79["walk.rs"]
  c5b4d030_44f4_60f6_27d3_745efbd9bf88 -->|defined in| 8031325b_dcd2_8c49_70e7_46191ce03a79
  3945042b_2431_cd64_6a3a_fcd4f3c6aab3["run()"]
  3945042b_2431_cd64_6a3a_fcd4f3c6aab3 -->|calls| c5b4d030_44f4_60f6_27d3_745efbd9bf88
  d5731d02_5c0a_719f_25a8_1f65951de674["recv()"]
  c5b4d030_44f4_60f6_27d3_745efbd9bf88 -->|calls| d5731d02_5c0a_719f_25a8_1f65951de674
  c1f3fe97_62b6_a409_398f_0c1f51503cd4["is_quit_now()"]
  c5b4d030_44f4_60f6_27d3_745efbd9bf88 -->|calls| c1f3fe97_62b6_a409_398f_0c1f51503cd4
  6ca570fb_1f05_6644_58a0_ced95322c8d7["send_quit()"]
  c5b4d030_44f4_60f6_27d3_745efbd9bf88 -->|calls| 6ca570fb_1f05_6644_58a0_ced95322c8d7
  a0a35873_a40b_86df_2790_0b532d73081f["deactivate_worker()"]
  c5b4d030_44f4_60f6_27d3_745efbd9bf88 -->|calls| a0a35873_a40b_86df_2790_0b532d73081f
  c7704f5c_4770_cbaa_eca8_43525d06b725["activate_worker()"]
  c5b4d030_44f4_60f6_27d3_745efbd9bf88 -->|calls| c7704f5c_4770_cbaa_eca8_43525d06b725
  style c5b4d030_44f4_60f6_27d3_745efbd9bf88 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

crates/ignore/src/walk.rs lines 1791–1838

    fn get_work(&mut self) -> Option<Work> {
        let mut value = self.recv();
        loop {
            // Simulate a priority channel: If quit_now flag is set, we can
            // receive only quit messages.
            if self.is_quit_now() {
                value = Some(Message::Quit)
            }
            match value {
                Some(Message::Work(work)) => {
                    return Some(work);
                }
                Some(Message::Quit) => {
                    // Repeat quit message to wake up sleeping threads, if
                    // any. The domino effect will ensure that every thread
                    // will quit.
                    self.send_quit();
                    return None;
                }
                None => {
                    if self.deactivate_worker() == 0 {
                        // If deactivate_worker() returns 0, every worker thread
                        // is currently within the critical section between the
                        // acquire in deactivate_worker() and the release in
                        // activate_worker() below.  For this to happen, every
                        // worker's local deque must be simultaneously empty,
                        // meaning there is no more work left at all.
                        self.send_quit();
                        return None;
                    }
                    // Wait for next `Work` or `Quit` message.
                    loop {
                        if let Some(v) = self.recv() {
                            self.activate_worker();
                            value = Some(v);
                            break;
                        }
                        // Our stack isn't blocking. Instead of burning the
                        // CPU waiting, we let the thread sleep for a bit. In
                        // general, this tends to only occur once the search is
                        // approaching termination.
                        let dur = std::time::Duration::from_millis(1);
                        std::thread::sleep(dur);
                    }
                }
            }
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does get_work() do?
get_work() is a function in the tailwindcss codebase, defined in crates/ignore/src/walk.rs.
Where is get_work() defined?
get_work() is defined in crates/ignore/src/walk.rs at line 1791.
What does get_work() call?
get_work() calls 5 function(s): activate_worker, deactivate_worker, is_quit_now, recv, send_quit.
What calls get_work()?
get_work() is called by 1 function(s): run.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free