Add thread spawn with proper trait checks.

This commit is contained in:
Drew Galbraith 2025-01-25 21:49:28 -08:00
parent 14585c005c
commit 9da38d608a
2 changed files with 58 additions and 0 deletions

View file

@ -3,6 +3,7 @@
extern crate alloc;
use alloc::boxed::Box;
use alloc::string::ToString;
use mammoth::debug;
use mammoth::define_entry;
@ -12,6 +13,10 @@ use yellowstone_yunq::GetEndpointRequest;
define_entry!();
pub fn testthread() {
debug!("Testing 1, 8 ,9");
}
#[no_mangle]
pub extern "C" fn main() -> z_err_t {
debug!("Testing!");
@ -28,11 +33,24 @@ pub extern "C" fn main() -> z_err_t {
debug!("Got endpoint w/ cap: {:#x}", endpoint.endpoint);
let a = Box::new(1);
let b = Box::new(1);
debug!("Addrs: {:p} {:p}", a, b);
let e: thread::ThreadEntry = |_| {
debug!("Testing 1 2 3");
};
let t = thread::Thread::spawn(e, core::ptr::null()).expect("Failed to spawn thread");
t.join().expect("Failed to wait.");
let x = Box::new(|| 1);
debug!("Addr: {:p}", x);
debug!("Addr: {:p}", &x);
let t = thread::spawn(testthread);
t.join().expect("Failed to wait.");
let t = thread::spawn(|| debug!("Testing 4, 5, 6"));
t.join().expect("Failed to wait.");
0