Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
//! This sample demonstrates creating a thread pool with 4 tasks and spawning 40 tasks that spin
//! for 100ms. It's expected to take about a second to run (assuming the machine has >= 4 logical
//! cores)
#![expect(clippy::print_stdout, reason = "Allowed in examples.")]
use bevy_platform::time::Instant;
use bevy_tasks::TaskPoolBuilder;
use core::time::Duration;
fn main() {
let pool = TaskPoolBuilder::new()
.thread_name("Busy Behavior ThreadPool".to_string())
.num_threads(4)
.build();
let t0 = Instant::now();
pool.scope(|s| {
for i in 0..40 {
s.spawn(async move {
let now = Instant::now();
while Instant::now() - now < Duration::from_millis(100) {
// spin, simulating work being done
}
println!(
"Thread {:?} index {} finished",
std::thread::current().id(),
i
);
});
}
});
let t1 = Instant::now();
println!("all tasks finished in {} secs", (t1 - t0).as_secs_f32());
}

View File

@@ -0,0 +1,35 @@
//! 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.
#![expect(clippy::print_stdout, reason = "Allowed in examples.")]
use bevy_platform::time::Instant;
use bevy_tasks::TaskPoolBuilder;
use core::time::Duration;
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");
}