Created a basic async runtime.
This commit is contained in:
parent
6814c26708
commit
34bd3b80d3
3 changed files with 150 additions and 0 deletions
|
|
@ -7,6 +7,8 @@ use alloc::boxed::Box;
|
|||
use alloc::string::ToString;
|
||||
use mammoth::debug;
|
||||
use mammoth::define_entry;
|
||||
use mammoth::task::Executor;
|
||||
use mammoth::task::Task;
|
||||
use mammoth::thread;
|
||||
use mammoth::zion::z_err_t;
|
||||
use yellowstone_yunq::GetEndpointRequest;
|
||||
|
|
@ -17,6 +19,22 @@ pub fn testthread() {
|
|||
debug!("Testing 1, 8 ,9");
|
||||
}
|
||||
|
||||
async fn inner_async() {
|
||||
debug!("Inner Async executed");
|
||||
}
|
||||
|
||||
async fn test_async() {
|
||||
debug!("Async executed");
|
||||
|
||||
let i = inner_async();
|
||||
|
||||
debug!("inner async created");
|
||||
|
||||
i.await;
|
||||
|
||||
debug!("inner async returned");
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn main() -> z_err_t {
|
||||
debug!("Testing!");
|
||||
|
|
@ -47,5 +65,11 @@ pub extern "C" fn main() -> z_err_t {
|
|||
let t = thread::spawn(|| debug!("Testing 4, 5, 6"));
|
||||
t.join().expect("Failed to wait.");
|
||||
|
||||
let mut executor = Executor::new();
|
||||
|
||||
executor.spawn(Task::new(test_async()));
|
||||
|
||||
executor.run();
|
||||
|
||||
0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue