• Home
  • Raw
  • Download

Lines Matching full:rwlock

18 /// This lock behaves in a similar manner to its namesake `std::sync::RwLock` but uses
52 /// let lock = spin::RwLock::new(5);
69 pub struct RwLock<T: ?Sized, R = Spin> { struct
93 inner: &'a RwLock<T, R>, argument
106 inner: &'a RwLock<T, R>,
110 // Same unsafe impls as `std::sync::RwLock`
111 unsafe impl<T: ?Sized + Send, R> Send for RwLock<T, R> {} implementation
112 unsafe impl<T: ?Sized + Send + Sync, R> Sync for RwLock<T, R> {} implementation
123 impl<T, R> RwLock<T, R> { implementation
131 /// static RW_LOCK: spin::RwLock<()> = spin::RwLock::new(());
141 RwLock { in new()
148 /// Consumes this `RwLock`, returning the underlying data.
153 let RwLock { data, .. } = self; in into_inner() localVariable
166 /// let lock = spin::RwLock::new(42);
186 impl<T: ?Sized, R: RelaxStrategy> RwLock<T, R> { impl
187 /// Locks this rwlock with shared read access, blocking the current thread
200 /// let mylock = spin::RwLock::new(0);
218 /// Lock this rwlock with exclusive write access, blocking the current
224 /// Returns an RAII guard which will drop the write access of this rwlock
228 /// let mylock = spin::RwLock::new(0);
259 impl<T: ?Sized, R> RwLock<T, R> { implementation
285 /// let mylock = spin::RwLock::new(0);
328 …/// Because [`RwLock`] guarantees exclusive mutable access, this function may only return either `…
388 /// Attempt to lock this rwlock with exclusive write access.
395 /// let mylock = spin::RwLock::new(0);
430 /// Since this call borrows the `RwLock` mutably, no actual locking needs to
436 /// let mut lock = spin::RwLock::new(0);
447 impl<T: ?Sized + fmt::Debug, R> fmt::Debug for RwLock<T, R> { implementation
450 Some(guard) => write!(f, "RwLock {{ data: ") in fmt()
453 None => write!(f, "RwLock {{ <locked> }}"), in fmt()
458 impl<T: ?Sized + Default, R> Default for RwLock<T, R> { implementation
464 impl<T, R> From<T> for RwLock<T, R> { implementation
470 impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> {
476 /// let mylock = spin::RwLock::new(0);
483 pub fn leak(this: Self) -> &'rwlock T { in leak()
490 impl<'rwlock, T: ?Sized + fmt::Debug> fmt::Debug for RwLockReadGuard<'rwlock, T> {
496 impl<'rwlock, T: ?Sized + fmt::Display> fmt::Display for RwLockReadGuard<'rwlock, T> {
502 impl<'rwlock, T: ?Sized, R: RelaxStrategy> RwLockUpgradableGuard<'rwlock, T, R> {
506 /// let mylock = spin::RwLock::new(0);
512 pub fn upgrade(mut self) -> RwLockWriteGuard<'rwlock, T, R> { in upgrade() argument
524 impl<'rwlock, T: ?Sized, R> RwLockUpgradableGuard<'rwlock, T, R> {
526 fn try_upgrade_internal(self, strong: bool) -> Result<RwLockWriteGuard<'rwlock, T, R>, Self> { in try_upgrade_internal() argument
556 /// let mylock = spin::RwLock::new(0);
565 pub fn try_upgrade(self) -> Result<RwLockWriteGuard<'rwlock, T, R>, Self> { in try_upgrade() argument
573 /// let mylock = spin::RwLock::new(1);
583 pub fn downgrade(self) -> RwLockReadGuard<'rwlock, T> { in downgrade() argument
603 /// let mylock = spin::RwLock::new(0);
610 pub fn leak(this: Self) -> &'rwlock T { in leak()
617 impl<'rwlock, T: ?Sized + fmt::Debug, R> fmt::Debug for RwLockUpgradableGuard<'rwlock, T, R> {
623 impl<'rwlock, T: ?Sized + fmt::Display, R> fmt::Display for RwLockUpgradableGuard<'rwlock, T, R> {
629 impl<'rwlock, T: ?Sized, R> RwLockWriteGuard<'rwlock, T, R> {
633 /// let mylock = spin::RwLock::new(0);
643 pub fn downgrade(self) -> RwLockReadGuard<'rwlock, T> { in downgrade() argument
661 /// let mylock = spin::RwLock::new(0);
670 pub fn downgrade_to_upgradeable(self) -> RwLockUpgradableGuard<'rwlock, T, R> { in downgrade_to_upgradeable() argument
696 /// let mylock = spin::RwLock::new(0);
704 pub fn leak(this: Self) -> &'rwlock mut T { in leak()
711 impl<'rwlock, T: ?Sized + fmt::Debug, R> fmt::Debug for RwLockWriteGuard<'rwlock, T, R> {
717 impl<'rwlock, T: ?Sized + fmt::Display, R> fmt::Display for RwLockWriteGuard<'rwlock, T, R> {
723 impl<'rwlock, T: ?Sized> Deref for RwLockReadGuard<'rwlock, T> {
732 impl<'rwlock, T: ?Sized, R> Deref for RwLockUpgradableGuard<'rwlock, T, R> {
741 impl<'rwlock, T: ?Sized, R> Deref for RwLockWriteGuard<'rwlock, T, R> {
750 impl<'rwlock, T: ?Sized, R> DerefMut for RwLockWriteGuard<'rwlock, T, R> {
757 impl<'rwlock, T: ?Sized> Drop for RwLockReadGuard<'rwlock, T> {
764 impl<'rwlock, T: ?Sized, R> Drop for RwLockUpgradableGuard<'rwlock, T, R> {
774 impl<'rwlock, T: ?Sized, R> Drop for RwLockWriteGuard<'rwlock, T, R> {
803 unsafe impl<R: RelaxStrategy> lock_api_crate::RawRwLock for RwLock<(), R> { implementation
856 unsafe impl<R: RelaxStrategy> lock_api_crate::RawRwLockUpgrade for RwLock<(), R> { implementation
905 unsafe impl<R: RelaxStrategy> lock_api_crate::RawRwLockDowngrade for RwLock<(), R> { implementation
917 unsafe impl lock_api::RawRwLockUpgradeDowngrade for RwLock<()> { implementation
946 type RwLock<T> = super::RwLock<T>; typedef
953 let l = RwLock::new(()); in smoke()
963 // static R: RwLock = RwLock::new();
989 let arc = Arc::new(RwLock::new(0)); in test_rw_arc()
1030 let arc = Arc::new(RwLock::new(1)); in test_rw_access_in_unwind()
1034 i: Arc<RwLock<isize>>, in test_rw_access_in_unwind()
1052 let rw: &RwLock<[i32]> = &RwLock::new([1, 2, 3]); in test_rwlock_unsized()
1066 let lock = RwLock::new(0isize); in test_rwlock_try_write()
1083 let m = RwLock::new(0); in test_rw_try_read()
1090 let m = RwLock::new(NonCopy(10)); in test_into_inner()
1103 let m = RwLock::new(Foo(num_drops.clone())); in test_into_inner_drop()
1114 let m = RwLock::new(()); in test_force_read_decrement()
1132 let m = RwLock::new(()); in test_force_write_unlock()
1143 let m = RwLock::new(()); in test_upgrade_downgrade()