Make PercpuBlock const constructable

This commit is contained in:
bjorn3
2025-09-15 19:00:03 +02:00
parent 3329a41121
commit 4884d749af
8 changed files with 62 additions and 11 deletions
+10 -1
View File
@@ -315,7 +315,6 @@ pub fn switch() -> SwitchResult {
///
/// This struct contains information such as the idle context, current context, and PIT tick counts,
/// as well as fields required for managing ptrace sessions and signals.
#[derive(Default)]
pub struct ContextSwitchPercpu {
switch_result: Cell<Option<SwitchResultInner>>,
pit_ticks: Cell<usize>,
@@ -329,6 +328,16 @@ pub struct ContextSwitchPercpu {
}
impl ContextSwitchPercpu {
pub const fn default() -> Self {
Self {
switch_result: Cell::new(None),
pit_ticks: Cell::new(0),
current_ctxt: RefCell::new(None),
idle_ctxt: RefCell::new(None),
being_sigkilled: Cell::new(false),
}
}
/// Applies a function to the current context, allowing controlled access.
///
/// # Parameters