get_work() — tailwindcss Function Reference
Architecture documentation for the get_work() function in walk.rs from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD cb90e027_d85a_8313_1295_ee1fd61c264c["get_work()"] 6cbc30c7_baf4_49d4_18b1_08a16e4fe724["run()"] 6cbc30c7_baf4_49d4_18b1_08a16e4fe724 -->|calls| cb90e027_d85a_8313_1295_ee1fd61c264c 9929665c_0d2e_34d8_29f9_3872e6b5afcc["recv()"] cb90e027_d85a_8313_1295_ee1fd61c264c -->|calls| 9929665c_0d2e_34d8_29f9_3872e6b5afcc c4269556_e666_134c_6b2c_540f841a33a5["is_quit_now()"] cb90e027_d85a_8313_1295_ee1fd61c264c -->|calls| c4269556_e666_134c_6b2c_540f841a33a5 ae7956a1_5713_0f4c_5a3b_5d431cb760a9["send_quit()"] cb90e027_d85a_8313_1295_ee1fd61c264c -->|calls| ae7956a1_5713_0f4c_5a3b_5d431cb760a9 05c12044_5622_099f_49a9_f0da64352151["deactivate_worker()"] cb90e027_d85a_8313_1295_ee1fd61c264c -->|calls| 05c12044_5622_099f_49a9_f0da64352151 8ea74802_e762_8a1c_e41b_970795daa5dd["activate_worker()"] cb90e027_d85a_8313_1295_ee1fd61c264c -->|calls| 8ea74802_e762_8a1c_e41b_970795daa5dd style cb90e027_d85a_8313_1295_ee1fd61c264c 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
Source
Frequently Asked Questions
What does get_work() do?
get_work() is a function in the tailwindcss codebase.
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