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 OxideEngine Scanner calls 5 called by 1

Entity Profile

Dependency Diagram

graph TD
  3ceac82a_b653_f5bd_6812_20a598404b10["get_work()"]
  b3ca296d_790b_9bf3_23ea_56e5c5c48565["walk.rs"]
  3ceac82a_b653_f5bd_6812_20a598404b10 -->|defined in| b3ca296d_790b_9bf3_23ea_56e5c5c48565
  d4471dbf_1765_272d_947d_466868f02720["run()"]
  d4471dbf_1765_272d_947d_466868f02720 -->|calls| 3ceac82a_b653_f5bd_6812_20a598404b10
  ad3996c3_a86f_7fbd_ed9d_9db1b2016783["recv()"]
  3ceac82a_b653_f5bd_6812_20a598404b10 -->|calls| ad3996c3_a86f_7fbd_ed9d_9db1b2016783
  45ae2908_78f1_bda4_b9ff_c7ed887252a9["is_quit_now()"]
  3ceac82a_b653_f5bd_6812_20a598404b10 -->|calls| 45ae2908_78f1_bda4_b9ff_c7ed887252a9
  6cb99283_dd73_4cad_876b_8595ea849d04["send_quit()"]
  3ceac82a_b653_f5bd_6812_20a598404b10 -->|calls| 6cb99283_dd73_4cad_876b_8595ea849d04
  f5a47c78_7a8f_5903_d3cb_eddbc854eeb0["deactivate_worker()"]
  3ceac82a_b653_f5bd_6812_20a598404b10 -->|calls| f5a47c78_7a8f_5903_d3cb_eddbc854eeb0
  dc40513a_8585_739a_d963_cfbacb026ee6["activate_worker()"]
  3ceac82a_b653_f5bd_6812_20a598404b10 -->|calls| dc40513a_8585_739a_d963_cfbacb026ee6
  style 3ceac82a_b653_f5bd_6812_20a598404b10 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