Skip to content

Commit 807203f

Browse files
committed
bios: Simplify init_threads
1 parent c823c4e commit 807203f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

examples/bios/src/thread.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,6 @@ pub fn reschedule_threads(
334334
}
335335

336336
pub fn init_threads(cs: &mut CriticalSection) {
337-
*CURRENT_THREAD.borrow(cs) = THREADS.borrow(cs).as_mut_ptr();
338-
339337
fn switch_threads(ctxt: IRQCtxt) -> *mut ThreadControlBlock {
340338
reschedule_threads(ctxt.tcb, ctxt.cs)
341339
}
@@ -344,7 +342,8 @@ pub fn init_threads(cs: &mut CriticalSection) {
344342
}
345343

346344
#[no_mangle]
347-
pub static CURRENT_THREAD: Global<*mut ThreadControlBlock> = Global::new(ptr::null_mut());
345+
pub static CURRENT_THREAD: Global<*mut ThreadControlBlock> =
346+
Global::new(THREADS.as_ptr() as *mut _);
348347

349348
static THREADS: Global<[ThreadControlBlock; 4]> = {
350349
let mut tcbs = [const { ThreadControlBlock::new([0; 31], [0; 3]) }; 4];

0 commit comments

Comments
 (0)