MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / critical_section

Function critical_section

user/src/bin/adder_atomic.rs:18–25  ·  view source on GitHub ↗
(t: &mut usize)

Source from the content-addressed store, hash-verified

16static mut PER_THREAD: usize = 0;
17
18unsafe fn critical_section(t: &mut usize) {
19 let a = &mut A as *mut usize;
20 let cur = a.read_volatile();
21 for _ in 0..500 {
22 *t = (*t) * (*t) % 10007;
23 }
24 a.write_volatile(cur + 1);
25}
26
27fn lock() {
28 while OCCUPIED

Callers 1

fFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected