timeslice::define_timeslice_sched! {
name: sched_main,
num_objs: 2,
tasks: {
{ name: task_10ms, period: 10 ms, cpu: 0, stack: 16 kiB },
{ name: task_50ms, period: 50 ms, cpu: 0, stack: 3 kiB },
{ name: task_100ms, period: 100 ms, cpu: 1, stack: 16 kiB },
{ name: task_1000ms, period: 1000 ms, cpu: 1, stack: 3 kiB }
}
}
struct MyThing1 {
}
impl MyThing1 {
fn new() -> Self {
Self {
}
}
}
impl sched_main::Ops for Box<MyThing1> {
fn task_10ms(&self) {
}
fn task_50ms(&self) {
}
fn task_100ms(&self) {
}
fn task_1000ms(&self) {
}
}
struct MyThing2 {
}
impl MyThing2 {
fn new() -> Self {
Self {
}
}
}
impl sched_main::Ops for Box<MyThing2> {
fn task_10ms(&self) {
}
fn task_100ms(&self) {
}
}
fn main() {
use std::sync::Arc;
let thing1 = Arc::new(Box::new(MyThing1::new()));
let thing2 = Arc::new(Box::new(MyThing2::new()));
let obj1 = Arc::clone(&thing1);
let obj2 = Arc::clone(&thing2);
sched_main::init([obj1, obj2]);
}