Home
last modified time | relevance | path

Searched refs:SpinLock (Results 1 – 25 of 41) sorted by relevance

12

/DragonOS-0.1.8/docs/kernel/locking/
Dspinlock.md13 …msp;DragonOS在`kernel/src/lib/spinlock.rs`文件中,实现了自旋锁。根据功能特性的略微差异,分别提供了`RawSpinLock`和`SpinLock`两种自旋锁。
30 ## 3. SpinLock - 具备守卫的自旋锁
32   `SpinLock`在`RawSpinLock`的基础上,进行了封装,能够在编译期检查出“未加锁就访问临界区的数据”、“忘记放锁”、“双重释放”等问题;并且,支持数据的内部可…
38 pub struct SpinLock<T> {
47 &emsp;&emsp;您可以这样初始化一个SpinLock
50 let x = SpinLock::new(Vec::new());
53 &emsp;&emsp;在初始化这个SpinLock时,必须把要保护的数据传入SpinLock,由SpinLock进行管理。
55 &emsp;&emsp;当需要读取、修改SpinLock保护的数据时,请先使用SpinLock的`lock()`方法。该方法会返回一个`SpinLockGuard`。您可以使用被保护的数据的成员函数…
60 let x :SpinLock<Vec<i32>>= SpinLock::new(Vec::new());
67 // 在此处,SpinLock是加锁的状态
[all …]
Dlocks.md25 - {ref}`SpinLock <_spinlock_doc_spinlock>` —— 在RawSpinLock的基础上,封装了一层守卫(Guard), 将锁及其要保护到的数据绑定在一个结构体内…
/DragonOS-0.1.8/kernel/src/driver/net/
Dmod.rs7 use crate::{libs::spinlock::SpinLock, syscall::SystemError};
27 fn inner_iface(&self) -> &SpinLock<smoltcp::iface::Interface>; in inner_iface()
Dvirtio_net.rs14 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/
Dmod.rs2 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/
Dlazy_init.rs25 use super::spinlock::SpinLock;
30 init_lock: SpinLock<()>,
44 init_lock: SpinLock::new(()), in new()
Dmutex.rs17 use super::spinlock::SpinLock;
34 inner: SpinLock<MutexInner>,
51 inner: SpinLock::new(MutexInner { in new()
Dspinlock.rs164 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
Dwait_queue.rs16 spinlock::{SpinLock, SpinLockGuard},
38 pub struct WaitQueue(SpinLock<InnerWaitQueue>);
41 pub const INIT: WaitQueue = WaitQueue(SpinLock::new(InnerWaitQueue::INIT));
Dnotifier.rs4 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/
Ddriver.rs2 use crate::{filesystem::vfs::IndexNode, libs::spinlock::SpinLock, syscall::SystemError};
52 pub struct LockedDriverManager(SpinLock<DriverManager>);
60 LockedDriverManager(SpinLock::new(DriverManager::new())) in new()
Dbus.rs14 libs::spinlock::SpinLock,
85 pub struct LockedBusManager(SpinLock<BusManager>);
95 LockedBusManager(SpinLock::new(BusManager { in new()
Dmod.rs11 libs::spinlock::SpinLock,
199 pub struct LockedDeviceManager(SpinLock<DeviceManager>);
203 LockedDeviceManager(SpinLock::new(DeviceManager::new())) in new()
/DragonOS-0.1.8/kernel/src/time/
Djiffies.rs6 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()
Dtimer.rs21 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()
Dclocksource.rs11 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/
Dmod.rs11 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());
Dahci_inode.rs9 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/
Dnull_dev.rs6 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()
Dzero_dev.rs6 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/
Duart.rs15 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/
Dc_adapter.rs12 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/
Dmod.rs6 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/
Dps2_keyboard.rs12 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/
Dmod.rs5 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()

12