1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Kernel building blocks.

#![deny(missing_docs)]
#![no_std]
#![feature(test)]
#![feature(allocator_api)]
#![feature(try_reserve)]
#![feature(box_into_pin)]
#![feature(generators, generator_trait)]
#![feature(dropck_eyepatch)]
#![feature(drain_filter)]
#![feature(async_closure)]
#![feature(type_alias_impl_trait)]
#![feature(generic_associated_types)]
#![feature(associated_type_defaults)]
#![feature(get_mut_unchecked)]
#![feature(new_uninit)]
#![feature(const_fn_fn_ptr_basics)]
#![feature(const_mut_refs)]
#![feature(const_fn_trait_bound)]
#![feature(bool_to_option)]
#![feature(option_result_unwrap_unchecked)]
#![feature(const_evaluatable_checked)]
#![feature(const_generics)]
#![feature(slice_ptr_get)]

extern crate alloc;

// So that we can use std when testing.
#[cfg(test)]
#[macro_use]
extern crate std;

#[cfg(test)]
extern crate test;

pub mod chan;
pub mod dev;
pub mod error;
pub mod utils;
pub mod vm;
pub use async_trait;
pub use ksched;

#[cfg(test)]
pub mod tests {
    use ksched::task;

    pub fn run_multi(ncpu: usize) {
        let mut threads = vec![];
        for _ in 0..ncpu {
            let t = std::thread::spawn(move || {
                task::run();
            });
            threads.push(t);
        }
        for thread in threads {
            thread.join().unwrap();
        }
    }
}