mirror of
https://github.com/bevyengine/bevy
synced 2024-11-30 00:20:20 +00:00
694c06f3d0
# Objective Currently the `missing_docs` lint is allowed-by-default and enabled at crate level when their documentations is complete (see #3492). This PR proposes to inverse this logic by making `missing_docs` warn-by-default and mark crates with imcomplete docs allowed. ## Solution Makes `missing_docs` warn at workspace level and allowed at crate level when the docs is imcomplete.
32 lines
985 B
Rust
32 lines
985 B
Rust
//! This sample demonstrates a thread pool with one thread per logical core and only one task
|
|
//! spinning. Other than the one thread, the system should remain idle, demonstrating good behavior
|
|
//! for small workloads.
|
|
|
|
use bevy_tasks::TaskPoolBuilder;
|
|
use web_time::{Duration, Instant};
|
|
|
|
fn main() {
|
|
let pool = TaskPoolBuilder::new()
|
|
.thread_name("Idle Behavior ThreadPool".to_string())
|
|
.build();
|
|
|
|
pool.scope(|s| {
|
|
for i in 0..1 {
|
|
s.spawn(async move {
|
|
println!("Blocking for 10 seconds");
|
|
let now = Instant::now();
|
|
while Instant::now() - now < Duration::from_millis(10000) {
|
|
// spin, simulating work being done
|
|
}
|
|
|
|
println!(
|
|
"Thread {:?} index {} finished",
|
|
std::thread::current().id(),
|
|
i
|
|
);
|
|
});
|
|
}
|
|
});
|
|
|
|
println!("all tasks finished");
|
|
}
|