Home
last modified time | relevance | path

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

12345

/DragonOS/docs/kernel/locking/
H A 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 …]
/DragonOS/kernel/src/driver/base/map/
H A Dmod.rs7 use crate::libs::spinlock::{SpinLock, SpinLockGuard};
35 pub struct LockedKObjMap(SpinLock<KObjMap>);
39 Self(SpinLock::new(KObjMap::default())) in default()
121 pub struct LockedDevsMap(SpinLock<DevsMap>);
125 LockedDevsMap(SpinLock::new(DevsMap::default())) in default()
/DragonOS/kernel/src/driver/scsi/
H A Dmod.rs7 libs::spinlock::{SpinLock, SpinLockGuard},
28 inner: SpinLock<InnerScsiManager>,
41 inner: SpinLock::new(InnerScsiManager { in new()
/DragonOS/kernel/src/libs/
H A Dspinlock.rs17 pub struct SpinLock<T> { struct
28 lock: &'a SpinLock<T>, argument
60 unsafe impl<T> Sync for SpinLock<T> where T: Send {} implementation
62 impl<T> SpinLock<T> { impl
H A Dlazy_init.rs25 use super::spinlock::SpinLock;
30 init_lock: SpinLock<()>,
44 init_lock: SpinLock::new(()), in new()
H A Dmutex.rs17 use super::spinlock::SpinLock;
34 inner: SpinLock<MutexInner>,
51 inner: SpinLock::new(MutexInner { in new()
/DragonOS/kernel/src/sched/
H A Dcompletion.rs6 libs::{spinlock::SpinLock, wait_queue::WaitQueue},
15 inner: SpinLock<InnerCompletion>,
21 inner: SpinLock::new(InnerCompletion::new()), in new()
/DragonOS/kernel/src/filesystem/
H A Deventfd.rs4 use crate::libs::spinlock::{SpinLock, SpinLockGuard};
51 eventfd: SpinLock<EventFd>,
53 epitems: SpinLock<LinkedList<Arc<EPollItem>>>,
59 eventfd: SpinLock::new(eventfd), in new()
61 epitems: SpinLock::new(LinkedList::new()), in new()
64 pub fn remove_epoll(&self, epoll: &Weak<SpinLock<EventPoll>>) -> Result<(), SystemError> { in remove_epoll()
/DragonOS/kernel/src/exception/
H A Dmsi.rs8 libs::spinlock::SpinLock,
67 inner: SpinLock<InnerMsiDesc>,
101 inner: SpinLock::new(InnerMsiDesc { in new()
/DragonOS/kernel/src/driver/base/block/
H A Dmanager.rs12 libs::spinlock::{SpinLock, SpinLockGuard},
37 inner: SpinLock<InnerBlockDevManager>,
46 inner: SpinLock::new(InnerBlockDevManager { in new()
210 inner: SpinLock<InnerBlockDevMeta>,
221 inner: SpinLock::new(InnerBlockDevMeta { in new()
/DragonOS/kernel/src/net/socket/
H A Dmod.rs26 spinlock::{SpinLock, SpinLockGuard},
51 … pub static ref SOCKET_SET: SpinLock<SocketSet<'static >> = SpinLock::new(SocketSet::new(vec![]));
251 fn remove_epoll(&mut self, epoll: &Weak<SpinLock<EventPoll>>) -> Result<(), SystemError> { in remove_epoll()
285 pub struct SocketInode(SpinLock<Box<dyn Socket>>, AtomicUsize);
289 Arc::new(Self(SpinLock::new(socket), AtomicUsize::new(0))) in new()
409 pub epitems: SpinLock<LinkedList<Arc<EPollItem>>>,
416 epitems: SpinLock::new(LinkedList::new()), in new()
433 pub fn remove_epoll(&self, epoll: &Weak<SpinLock<EventPoll>>) -> Result<(), SystemError> { in remove_epoll()
497 tcp_port_table: SpinLock<HashMap<u16, Pid>>,
499 udp_port_table: SpinLock<HashMap<u16, Pid>>,
[all …]
H A Dunix.rs4 use crate::{libs::spinlock::SpinLock, net::Endpoint};
14 buffer: Arc<SpinLock<Vec<u8>>>,
31 let buffer = Arc::new(SpinLock::new(Vec::with_capacity(Self::DEFAULT_BUF_SIZE))); in new()
129 buffer: Arc<SpinLock<Vec<u8>>>,
146 let buffer = Arc::new(SpinLock::new(Vec::with_capacity(Self::DEFAULT_BUF_SIZE))); in new()
/DragonOS/kernel/src/driver/net/e1000e/
H A De1000e_driver.rs15 spinlock::{SpinLock, SpinLockGuard},
45 pub inner: Arc<SpinLock<E1000EDevice>>,
86 iface: SpinLock<smoltcp::iface::Interface>,
88 inner: SpinLock<InnerE1000EInterface>,
133 let inner: Arc<SpinLock<E1000EDevice>> = Arc::new(SpinLock::new(device)); in new()
208 iface: SpinLock::new(iface), in new()
210 inner: SpinLock::new(InnerE1000EInterface { in new()
349 fn inner_iface(&self) -> &SpinLock<smoltcp::iface::Interface> { in inner_iface()
/DragonOS/kernel/src/driver/tty/
H A Dtty_port.rs7 use crate::libs::spinlock::{SpinLock, SpinLockGuard};
110 port_data: SpinLock<TtyPortData>,
116 port_data: SpinLock::new(TtyPortData::new()), in new()
/DragonOS/kernel/src/mm/
H A Dc_adapter.rs10 use crate::libs::spinlock::SpinLock;
16 …static ref C_ALLOCATION_MAP: SpinLock<HashMap<VirtAddr, (VirtAddr, usize, usize)>> = SpinLock::new…
/DragonOS/kernel/src/driver/base/
H A Dsubsys.rs9 spinlock::SpinLock,
36 bus: SpinLock<Option<Weak<dyn Bus>>>,
38 class: SpinLock<Option<Weak<dyn Class>>>,
77 bus: SpinLock::new(bus), in new()
78 class: SpinLock::new(class), in new()
/DragonOS/kernel/src/arch/x86_64/driver/apic/
H A Dlapic_vector.rs29 libs::spinlock::{SpinLock, SpinLockGuard},
43 inner: SpinLock<InnerIrqChip>,
49 inner: SpinLock::new(InnerIrqChip { in new()
126 inner: SpinLock<InnerApicChipData>,
138 inner: SpinLock::new(InnerApicChipData { in new()
/DragonOS/kernel/src/driver/net/
H A Dmod.rs9 use crate::libs::spinlock::SpinLock;
69 fn inner_iface(&self) -> &SpinLock<smoltcp::iface::Interface>; in inner_iface()
H A Dloopback.rs13 use crate::libs::spinlock::{SpinLock, SpinLockGuard};
169 pub inner: Arc<SpinLock<Loopback>>,
175 let inner = Arc::new(SpinLock::new(Loopback::new())); in new()
248 iface: SpinLock<smoltcp::iface::Interface>,
250 inner: SpinLock<InnerLoopbackInterface>,
291 iface: SpinLock::new(iface), in new()
293 inner: SpinLock::new(InnerLoopbackInterface { in new()
508 fn inner_iface(&self) -> &SpinLock<smoltcp::iface::Interface> { in inner_iface()
/DragonOS/kernel/src/filesystem/devfs/
H A Dnull_dev.rs8 use crate::{libs::spinlock::SpinLock, time::PosixTimeSpec};
31 pub struct LockedNullInode(SpinLock<NullInode>);
57 let result = Arc::new(LockedNullInode(SpinLock::new(inode))); in new()
H A Dzero_dev.rs8 use crate::{libs::spinlock::SpinLock, time::PosixTimeSpec};
31 pub struct LockedZeroInode(SpinLock<ZeroInode>);
57 let result = Arc::new(LockedZeroInode(SpinLock::new(inode))); in new()
/DragonOS/kernel/src/filesystem/procfs/
H A Dkmsg.rs5 use crate::libs::spinlock::SpinLock;
18 pub static mut KMSG: Option<SpinLock<Kmsg>> = None;
23 let kmsg = SpinLock::new(Kmsg::new()); in kmsg_init()
/DragonOS/kernel/src/time/
H A Djiffies.rs8 use crate::{arch::time::CLOCK_TICK_RATE, libs::spinlock::SpinLock};
30 pub struct ClocksourceJiffies(SpinLock<InnerJiffies>);
88 let jiffies = Arc::new(ClocksourceJiffies(SpinLock::new(InnerJiffies { in new()
/DragonOS/kernel/src/driver/clocksource/
H A Dtimer_riscv.rs21 libs::spinlock::SpinLock,
32 static SBI_TIMER_INIT_BMP: SpinLock<StaticBitmap<{ PerCpu::MAX_CPU_NUM as usize }>> =
33 SpinLock::new(StaticBitmap::new());
/DragonOS/kernel/src/process/
H A Dkthread.rs20 libs::{once::Once, spinlock::SpinLock},
28 static KTHREAD_CREATE_LIST: SpinLock<LinkedList<Arc<KernelThreadCreateInfo>>> =
29 SpinLock::new(LinkedList::new());
129 closure: SpinLock<Option<Box<KernelThreadClosure>>>,
134 result_pcb: SpinLock<Option<Arc<ProcessControlBlock>>>,
154 closure: SpinLock::new(Some(Box::new(func))), in new()
157 result_pcb: SpinLock::new(None), in new()

12345