/DragonOS-0.1.8/docs/kernel/locking/ |
D | spinlock.md | 13 …msp;DragonOS在`kernel/src/lib/spinlock.rs`文件中,实现了自旋锁。根据功能特性的略微差异,分别提供了`RawSpinLock`和`SpinLock`两种自旋锁。 30 ## 3. SpinLock - 具备守卫的自旋锁 32   `SpinLock`在`RawSpinLock`的基础上,进行了封装,能够在编译期检查出“未加锁就访问临界区的数据”、“忘记放锁”、“双重释放”等问题;并且,支持数据的内部可… 38 pub struct SpinLock<T> { 47   您可以这样初始化一个SpinLock: 50 let x = SpinLock::new(Vec::new()); 53   在初始化这个SpinLock时,必须把要保护的数据传入SpinLock,由SpinLock进行管理。 55   当需要读取、修改SpinLock保护的数据时,请先使用SpinLock的`lock()`方法。该方法会返回一个`SpinLockGuard`。您可以使用被保护的数据的成员函数… 60 let x :SpinLock<Vec<i32>>= SpinLock::new(Vec::new()); 67 // 在此处,SpinLock是加锁的状态 [all …]
|
D | locks.md | 25 - {ref}`SpinLock <_spinlock_doc_spinlock>` —— 在RawSpinLock的基础上,封装了一层守卫(Guard), 将锁及其要保护到的数据绑定在一个结构体内…
|
/DragonOS-0.1.8/kernel/src/driver/net/ |
D | mod.rs | 7 use crate::{libs::spinlock::SpinLock, syscall::SystemError}; 27 fn inner_iface(&self) -> &SpinLock<smoltcp::iface::Interface>; in inner_iface()
|
D | virtio_net.rs | 14 libs::spinlock::SpinLock, 24 pub inner: Arc<SpinLock<VirtIONet<HalImpl, T, 2>>>, 69 iface: SpinLock<smoltcp::iface::Interface>, 102 iface: SpinLock::new(iface), in new() 122 let inner: Arc<SpinLock<VirtIONet<HalImpl, T, 2>>> = Arc::new(SpinLock::new(driver_net)); in new() 294 fn inner_iface(&self) -> &SpinLock<smoltcp::iface::Interface> { in inner_iface()
|
/DragonOS-0.1.8/kernel/src/driver/base/map/ |
D | mod.rs | 2 use crate::libs::spinlock::SpinLock; 22 pub struct LockedKObjMap(SpinLock<KObjMap>); 26 Self(SpinLock::new(KObjMap::default())) in default()
|
/DragonOS-0.1.8/kernel/src/libs/ |
D | lazy_init.rs | 25 use super::spinlock::SpinLock; 30 init_lock: SpinLock<()>, 44 init_lock: SpinLock::new(()), in new()
|
D | mutex.rs | 17 use super::spinlock::SpinLock; 34 inner: SpinLock<MutexInner>, 51 inner: SpinLock::new(MutexInner { in new()
|
D | spinlock.rs | 164 pub struct SpinLock<T> { struct 175 lock: &'a SpinLock<T>, argument 199 unsafe impl<T> Sync for SpinLock<T> where T: Send {} implementation 201 impl<T> SpinLock<T> { implementation
|
D | wait_queue.rs | 16 spinlock::{SpinLock, SpinLockGuard}, 38 pub struct WaitQueue(SpinLock<InnerWaitQueue>); 41 pub const INIT: WaitQueue = WaitQueue(SpinLock::new(InnerWaitQueue::INIT));
|
D | notifier.rs | 4 libs::{rwlock::RwLock, spinlock::SpinLock}, 99 pub struct AtomicNotifierChain<T>(SpinLock<NotifierChain<T>>); 103 Self(SpinLock::new(NotifierChain::<T>::new())) in new()
|
/DragonOS-0.1.8/kernel/src/driver/base/device/ |
D | driver.rs | 2 use crate::{filesystem::vfs::IndexNode, libs::spinlock::SpinLock, syscall::SystemError}; 52 pub struct LockedDriverManager(SpinLock<DriverManager>); 60 LockedDriverManager(SpinLock::new(DriverManager::new())) in new()
|
D | bus.rs | 14 libs::spinlock::SpinLock, 85 pub struct LockedBusManager(SpinLock<BusManager>); 95 LockedBusManager(SpinLock::new(BusManager { in new()
|
D | mod.rs | 11 libs::spinlock::SpinLock, 199 pub struct LockedDeviceManager(SpinLock<DeviceManager>); 203 LockedDeviceManager(SpinLock::new(DeviceManager::new())) in new()
|
/DragonOS-0.1.8/kernel/src/time/ |
D | jiffies.rs | 6 use crate::{kerror, kinfo, libs::spinlock::SpinLock, syscall::SystemError}; 26 pub struct ClocksourceJiffies(SpinLock<InnerJiffies>); 75 let jieffies = Arc::new(ClocksourceJiffies(SpinLock::new(InnerJiffies { in new()
|
D | timer.rs | 21 libs::spinlock::SpinLock, 32 pub static ref TIMER_LIST: SpinLock<LinkedList<Arc<Timer>>> = SpinLock::new(LinkedList::new()); 62 pub struct Timer(SpinLock<InnerTimer>); 73 let result: Arc<Timer> = Arc::new(Timer(SpinLock::new(InnerTimer { in new()
|
D | clocksource.rs | 11 include::bindings::bindings::run_watchdog_kthread, kdebug, kinfo, libs::spinlock::SpinLock, 23 pub static ref CLOCKSOURCE_LIST: SpinLock<LinkedList<Arc<dyn Clocksource>>> = 24 SpinLock::new(LinkedList::new()); 26 pub static ref WATCHDOG_LIST: SpinLock<LinkedList<Arc<dyn Clocksource>>> = 27 SpinLock::new(LinkedList::new()); 29 …pub static ref CLOCKSOUCE_WATCHDOG:SpinLock<ClocksouceWatchdog> = SpinLock::new(ClocksouceWatchdo… 31 pub static ref OVERRIDE_NAME: SpinLock<String> = SpinLock::new(String::from("")); 37 pub static CUR_CLOCKSOURCE: SpinLock<Option<Arc<dyn Clocksource>>> = SpinLock::new(None);
|
/DragonOS-0.1.8/kernel/src/driver/disk/ahci/ |
D | mod.rs | 11 use crate::libs::spinlock::{SpinLock, SpinLockGuard}; 35 static LOCKED_HBA_MEM_LIST: SpinLock<Vec<&mut HbaMem>> = SpinLock::new(Vec::new()); 36 static LOCKED_DISKS_LIST: SpinLock<Vec<Arc<LockedAhciDisk>>> = SpinLock::new(Vec::new());
|
D | ahci_inode.rs | 9 use crate::{libs::spinlock::SpinLock, time::TimeSpec}; 33 pub struct LockedAhciInode(pub SpinLock<AhciInode>); 60 let result = Arc::new(LockedAhciInode(SpinLock::new(inode))); in new()
|
/DragonOS-0.1.8/kernel/src/filesystem/devfs/ |
D | null_dev.rs | 6 use crate::{libs::spinlock::SpinLock, syscall::SystemError, time::TimeSpec}; 28 pub struct LockedNullInode(SpinLock<NullInode>); 54 let result = Arc::new(LockedNullInode(SpinLock::new(inode))); in new()
|
D | zero_dev.rs | 6 use crate::{libs::spinlock::SpinLock, syscall::SystemError, time::TimeSpec}; 28 pub struct LockedZeroInode(SpinLock<ZeroInode>); 54 let result = Arc::new(LockedZeroInode(SpinLock::new(inode))); in new()
|
/DragonOS-0.1.8/kernel/src/driver/uart/ |
D | uart.rs | 15 libs::spinlock::SpinLock, 120 pub struct LockedUart(SpinLock<Uart>); 124 Self(SpinLock::new(Uart::default())) in default() 196 pub struct LockedUartDriver(SpinLock<UartDriver>); 200 Self(SpinLock::new(UartDriver::default())) in default() 242 Self(SpinLock::new(UartDriver::new(port, baud_rate, sys_info))) in new()
|
/DragonOS-0.1.8/kernel/src/mm/ |
D | c_adapter.rs | 12 libs::{align::page_align_up, spinlock::SpinLock}, 24 …static ref C_ALLOCATION_MAP: SpinLock<HashMap<VirtAddr, (VirtAddr, usize, usize)>> = SpinLock::new…
|
/DragonOS-0.1.8/kernel/src/driver/base/platform/ |
D | mod.rs | 6 use crate::{filesystem::vfs::IndexNode, libs::spinlock::SpinLock, syscall::SystemError}; 51 pub struct LockedPlatformBusDriver(SpinLock<PlatformBusDriver>); 60 LockedPlatformBusDriver(SpinLock::new(PlatformBusDriver::new())) in new() 268 pub struct LockedPlatform(SpinLock<Platform>); 275 LockedPlatform(SpinLock::new(Platform::new())) in new()
|
/DragonOS-0.1.8/kernel/src/driver/keyboard/ |
D | ps2_keyboard.rs | 12 libs::{keyboard_parser::TypeOneFSM, rwlock::RwLock, spinlock::SpinLock}, 21 static ref PS2_KEYBOARD_FSM: SpinLock<TypeOneFSM> = { 27 SpinLock::new(TypeOneFSM::new(tty0))
|
/DragonOS-0.1.8/kernel/src/driver/base/char/ |
D | mod.rs | 5 use crate::{filesystem::vfs::IndexNode, kerror, libs::spinlock::SpinLock, syscall::SystemError}; 40 pub struct LockedChrDevs(SpinLock<ChrDevs>); 44 LockedChrDevs(SpinLock::new(ChrDevs::default())) in default()
|