ostd/timer/mod.rs
1// SPDX-License-Identifier: MPL-2.0
2//! The timer support.
3pub(crate) mod jiffies;
4
5/* use alloc::{boxed::Box, vec::Vec};
6use core::cell::RefCell; */
7
8pub use jiffies::Jiffies;
9
10/* use crate::{cpu_local, trap};
11
12type InterruptCallback = Box<dyn Fn() + Sync + Send>;
13
14cpu_local! {
15 pub(crate) static INTERRUPT_CALLBACKS: RefCell<Vec<InterruptCallback>> = RefCell::new(Vec::new());
16}
17
18/// Register a function that will be executed during the system timer interruption.
19pub fn register_callback<F>(func: F)
20where
21 F: Fn() + Sync + Send + 'static,
22{
23 let irq_guard = trap::irq::disable_local();
24 INTERRUPT_CALLBACKS
25 .get_with(&irq_guard)
26 .borrow_mut()
27 .push(Box::new(func));
28} */