Add comments in ch6
This commit is contained in:
parent
cea2febe35
commit
f9346edad1
35 changed files with 374 additions and 116 deletions
|
@ -1,3 +1,4 @@
|
|||
//! Uniprocessor interior mutability primitives
|
||||
use core::cell::{RefCell, RefMut};
|
||||
|
||||
/// Wrap a static data structure inside it so that we are
|
||||
|
@ -22,7 +23,7 @@ impl<T> UPSafeCell<T> {
|
|||
inner: RefCell::new(value),
|
||||
}
|
||||
}
|
||||
/// Panic if the data has been borrowed.
|
||||
/// Exclusive access inner data in UPSafeCell. Panic if the data has been borrowed.
|
||||
pub fn exclusive_access(&self) -> RefMut<'_, T> {
|
||||
self.inner.borrow_mut()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue