| /external/rust/crates/tokio/tests/ |
| D | sync_rwlock.rs | 16 use tokio::sync::RwLock; 22 let rwlock = RwLock::new(42); in into_inner() localVariable 23 assert_eq!(rwlock.into_inner(), 42); in into_inner() 29 let rwlock = RwLock::new(100); in read_shared() localVariable 31 let mut t1 = spawn(rwlock.read()); in read_shared() 33 let mut t2 = spawn(rwlock.read()); in read_shared() 40 let rwlock = RwLock::new(100); in write_shared_pending() localVariable 41 let mut t1 = spawn(rwlock.read()); in write_shared_pending() 44 let mut t2 = spawn(rwlock.write()); in write_shared_pending() 51 let rwlock = RwLock::new(100); in read_exclusive_pending() localVariable [all …]
|
| /external/mesa3d/src/util/ |
| D | rwlock.h | 44 SRWLOCK rwlock; member 46 pthread_rwlock_t rwlock; 50 static inline int u_rwlock_init(struct u_rwlock *rwlock) in u_rwlock_init() argument 53 InitializeSRWLock(&rwlock->rwlock); in u_rwlock_init() 56 return pthread_rwlock_init(&rwlock->rwlock, NULL); in u_rwlock_init() 60 static inline int u_rwlock_destroy(struct u_rwlock *rwlock) in u_rwlock_destroy() argument 65 return pthread_rwlock_destroy(&rwlock->rwlock); in u_rwlock_destroy() 69 static inline int u_rwlock_rdlock(struct u_rwlock *rwlock) in u_rwlock_rdlock() argument 72 AcquireSRWLockShared(&rwlock->rwlock); in u_rwlock_rdlock() 75 return pthread_rwlock_rdlock(&rwlock->rwlock); in u_rwlock_rdlock() [all …]
|
| /external/rust/crates/lock_api/src/ |
| D | rwlock.rs | 29 /// Types implementing this trait can be used by `RwLock` to form a safe and 30 /// fully-functioning `RwLock` type. 34 /// Implementations of this trait must ensure that the `RwLock` is actually 39 /// Initial value for an unlocked `RwLock`. 75 /// Checks if this `RwLock` is currently locked in any way. 88 /// Check if this `RwLock` is currently exclusively locked. 191 /// to recursively lock a `RwLock`. However using this method can cause 330 pub struct RwLock<R, T: ?Sized> { struct 337 impl<R, T> Serialize for RwLock<R, T> implementation 351 impl<'de, R, T> Deserialize<'de> for RwLock<R, T> implementation [all …]
|
| /external/rust/crates/tokio/src/sync/ |
| D | rwlock.rs | 39 /// become available to yield. An `RwLock` will allow any number of readers to 48 /// `std::sync::RwLock`, where the priority policy is dependent on the 60 /// use tokio::sync::RwLock; 64 /// let lock = RwLock::new(5); 84 /// [`RwLock`]: struct@RwLock 90 pub struct RwLock<T: ?Sized> { struct 113 check_send::<RwLock<u32>>(); in bounds() argument 114 check_sync::<RwLock<u32>>(); in bounds() 115 check_unpin::<RwLock<u32>>(); in bounds() 141 let rwlock = Arc::new(RwLock::new(0)); in bounds() localVariable [all …]
|
| /external/rust/crates/spin/src/ |
| D | rwlock.rs | 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> { impl 131 /// static RW_LOCK: spin::RwLock<()> = spin::RwLock::new(()); [all …]
|
| D | lib.rs | 11 //! - `Mutex`, `RwLock`, `Once`/`SyncOnceCell`, and `SyncLazy` equivalents 17 //! - Upgradeable `RwLock` guards 44 //! - [`RwLock`] supports counting readers and writers. 87 #[cfg(feature = "rwlock")] 88 #[cfg_attr(docsrs, doc(cfg(feature = "rwlock")))] 89 pub mod rwlock; module 98 #[cfg(feature = "rwlock")] 99 #[cfg_attr(docsrs, doc(cfg(feature = "rwlock")))] 100 pub use rwlock::RwLockReadGuard; 138 /// A lock that provides data access to either one writer or many readers. See [`rwlock::RwLock`] f… [all …]
|
| /external/swiftshader/third_party/llvm-10.0/llvm/lib/Support/ |
| D | RWMutex.cpp | 44 pthread_rwlock_t* rwlock = in RWMutexImpl() local 49 bzero(rwlock, sizeof(pthread_rwlock_t)); in RWMutexImpl() 52 // Initialize the rwlock in RWMutexImpl() 53 int errorcode = pthread_rwlock_init(rwlock, nullptr); in RWMutexImpl() 58 data_ = rwlock; in RWMutexImpl() 64 pthread_rwlock_t* rwlock = static_cast<pthread_rwlock_t*>(data_); in ~RWMutexImpl() local 65 assert(rwlock != nullptr); in ~RWMutexImpl() 66 pthread_rwlock_destroy(rwlock); in ~RWMutexImpl() 67 free(rwlock); in ~RWMutexImpl() 73 pthread_rwlock_t* rwlock = static_cast<pthread_rwlock_t*>(data_); in lock_shared() local [all …]
|
| /external/llvm/lib/Support/ |
| D | RWMutex.cpp | 50 pthread_rwlock_t* rwlock = in RWMutexImpl() local 55 bzero(rwlock, sizeof(pthread_rwlock_t)); in RWMutexImpl() 58 // Initialize the rwlock in RWMutexImpl() 59 int errorcode = pthread_rwlock_init(rwlock, nullptr); in RWMutexImpl() 64 data_ = rwlock; in RWMutexImpl() 70 pthread_rwlock_t* rwlock = static_cast<pthread_rwlock_t*>(data_); in ~RWMutexImpl() local 71 assert(rwlock != nullptr); in ~RWMutexImpl() 72 pthread_rwlock_destroy(rwlock); in ~RWMutexImpl() 73 free(rwlock); in ~RWMutexImpl() 79 pthread_rwlock_t* rwlock = static_cast<pthread_rwlock_t*>(data_); in reader_acquire() local [all …]
|
| /external/rust/crates/parking_lot/src/ |
| D | rwlock.rs | 34 /// other threads waiting to acquire the rwlock. While this improves throughput 36 /// a rwlock it has just released, this can starve other threads. 38 /// This rwlock uses [eventual fairness](https://trac.webkit.org/changeset/203350) 41 /// which will force the lock to go to the next thread waiting for the rwlock. 51 /// # Differences from the standard library `RwLock` 57 /// `RwLock` due to platform limitations. 63 /// - Supports eventual fairness so that the rwlock is fair on average. 64 /// - Optionally allows making the rwlock fair by calling 70 /// use parking_lot::RwLock; 72 /// let lock = RwLock::new(5); [all …]
|
| /external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_unlock/ |
| D | 1-1.c | 7 * Test that pthread_rwlock_unlock(pthread_rwlock_t *rwlock) 10 * read-write lock object referenced by rwlock 18 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 19 * 2. Main thread read lock 'rwlock' 20 * 3. Create a child thread, the thread read lock 'rwlock', should not block 21 * 4. Child thread unlock 'rwlock', while the main thread still hold the read lock. 22 * 5. Child thread read lock 'rwlock' again, should succeed, then unlock again 23 * 6. Child thread write lock 'rwlock', should block 24 * 7. Main thread unlock the read lock, the 'rwlock' is in unlocked state 33 static pthread_rwlock_t rwlock; variable [all …]
|
| D | 4-2.c | 7 * Test that pthread_rwlock_unlock(pthread_rwlock_t *rwlock) 10 * [EINVAL] rwlock doesn't refer to an initialized read-write lock 11 * [EPERM] the current thread doesn't hold the lock on the rwlock 17 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 18 * 2. Main thread read lock 'rwlock' 19 * 3. Create a child thread, the thread should try to unlock the 'rwlock' 31 static pthread_rwlock_t rwlock; variable 48 rc = pthread_rwlock_unlock(&rwlock); in fn_unlk() 60 printf("Unlocking rwlock in different thread is undefined on Linux\n"); in main() 64 if (pthread_rwlock_init(&rwlock, NULL) != 0) { in main() [all …]
|
| D | 2-1.c | 7 * Test that pthread_rwlock_unlock(pthread_rwlock_t *rwlock) 10 * read-write lock object referenced by rwlock 18 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 19 * 2. Main thread write lock 'rwlock' 20 * 3. Create a child thread, the thread write lock 'rwlock', should block 21 * 4. Main thread unlock the write lock, the 'rwlock' is in unlocked state 30 static pthread_rwlock_t rwlock; variable 50 if (pthread_rwlock_wrlock(&rwlock) != 0) { in fn_wr() 56 rc = pthread_rwlock_unlock(&rwlock); in fn_wr() 74 if (pthread_rwlock_init(&rwlock, NULL) != 0) { in main() [all …]
|
| /external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_tryrdlock/ |
| D | 1-1.c | 7 * Test that pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) 19 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 20 * 2. Main thread read lock 'rwlock' 21 …* 3. Create a child thread, the thread read lock 'rwlock' using pthread_rwlock_tryrdlock(), shoul… 22 * 4. Main thread unlock 'rwlock' 23 * 5. Main thread write lock 'rwlock' 24 …* 6. Create child thread to read lock 'rwlock' with pthread_rwlock_tryrdlock(), should not block … 25 * 7. Main thread unlock 'rwlock' 34 static pthread_rwlock_t rwlock; variable 53 rc = pthread_rwlock_tryrdlock(&rwlock); in fn_rd_1() [all …]
|
| /external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_wrlock/ |
| D | 1-1.c | 7 * Test pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) 10 * 'rwlock'. The calling thread acquires the write lock if no other thread 11 * (reader or writer) holds the read-write lock 'rwlock'. Otherwise, the thread 15 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 16 * 2. Main thread lock 'rwlock' for reading with pthread_rwlock_rdlock() 17 * 3. Create a child thread, the thread lock 'rwlock' for writing, shall block 18 * 4. Main thread unlock 'rwlock', child thread should get the write lock 19 * 5. Main thread lock 'rwlock' for writing 20 * 6. Create child thread to lock 'rwlock' for writing, should block 21 * 7. Main thread unlock 'rwlock' [all …]
|
| D | 3-1.c | 7 * Test pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) 10 * [EDEADLK] The current thread already owns the rwlock for writing or reading. 13 * 1. Create and initialize an rwlock 15 * 3. Perform a write lock _again_ with pthread_rwlock_wrlock without first unlocking rwlock() 29 static pthread_rwlock_t rwlock; in main() local 32 if (pthread_rwlock_init(&rwlock, NULL) != 0) { in main() 37 /* Attempt to write lock rwlock, it should return successfully */ in main() 40 if (pthread_rwlock_wrlock(&rwlock) != 0) { in main() 46 /* Now attempt to write lock again without first unlocking rwlock. It may return in main() 50 rc = pthread_rwlock_wrlock(&rwlock); in main() [all …]
|
| /external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/ |
| D | 5-1.c | 7 * Test that pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) 9 * A thread may hold multiple concurrent read locks on 'rwlock' and the application shall 13 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 14 * 2. Main read locks 'rwlock' 10 times 15 * 3. Main unlocks 'rwlock' 10 times. 29 static pthread_rwlock_t rwlock; in main() local 32 if (pthread_rwlock_init(&rwlock, NULL) != 0) { in main() 38 if (pthread_rwlock_rdlock(&rwlock) != 0) { in main() 40 ("Test FAILED: main cannot get read-lock rwlock number: %d\n", in main() 47 if (pthread_rwlock_unlock(&rwlock) != 0) { in main() [all …]
|
| D | 1-1.c | 7 * Test that pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) 10 * read-write lock referenced by rwlock. The calling thread acquires 18 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 19 * 2. Main thread read lock 'rwlock' 20 * 3. Create a child thread. The thread read lock 'rwlock', should not block. Then unlock it. 21 * 4. Main thread unlock 'rwlock' 22 * 5. Main thread write lock 'rwlock' 23 * 6. Create child thread to read lock 'rwlock', should block 24 * 7. Main thread unlock 'rwlock' 32 static pthread_rwlock_t rwlock; variable [all …]
|
| /external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/ |
| D | 1-1.c | 7 * Test that pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock) 10 * rwlock as in the pthread_rwlock_rdlock(). However, if the lock cannot be 15 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 16 * 2. Main thread lock 'rwlock' for reading with pthread_rwlock_rdlock() 17 * 3. Create a child thread, the thread lock 'rwlock' for reading, 18 * using pthread_rwlock_timedrdlock(), should get read lock. Thread unlocks 'rwlock'. 19 * 4. Main thread unlock 'rwlock' 20 * 5. Main thread lock 'rwlock' for writing 21 * 6. Create child thread to lock 'rwlock' for reading, 24 * 7. Main thread unlock 'rwlock' [all …]
|
| D | 3-1.c | 7 * Test that pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock) 10 * rwlock as in the pthread_rwlock_rdlock(). However, if the lock cannot be 15 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 16 * 2. Main thread lock 'rwlock' for reading with pthread_rwlock_rdlock() 17 * 3. Create a child thread, the thread lock 'rwlock' for reading, 18 * using pthread_rwlock_timedrdlock(), should get read lock. Thread unlocks 'rwlock'. 19 * 4. Main thread unlock 'rwlock' 20 * 5. Main thread lock 'rwlock' for writing 21 * 6. Create child thread to lock 'rwlock' for reading, 24 * 7. Main thread unlock 'rwlock' [all …]
|
| D | 5-1.c | 7 * Test that pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock) 15 * 2. Child thread lock 'rwlock' for reading with pthread_rwlock_timedrdlock(), 17 * 3. The child thread unlocks the 'rwlock' and exits. 19 * 4. The child thread lock 'rwlock' for reading, with pthread_rwlock_timedrdlock(), 45 pthread_rwlock_t rwlock; in fn_rd_1() local 47 if (pthread_rwlock_init(&rwlock, NULL) != 0) { in fn_rd_1() 59 rc = pthread_rwlock_timedrdlock(&rwlock, &abs_timeout); in fn_rd_1() 67 if (pthread_rwlock_unlock(&rwlock) != 0) { in fn_rd_1() 76 if (pthread_rwlock_destroy(&rwlock) != 0) { in fn_rd_1() 90 pthread_rwlock_t rwlock; in fn_rd_2() local [all …]
|
| /external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_trywrlock/ |
| D | 1-1.c | 7 * Test pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) 10 * that the function shall fail if any thread currently holds rwlock(for reading and writing). 13 * 1. Initialize a pthread_rwlock_t object 'rwlock' with pthread_rwlock_init() 14 * 2. Main thread lock 'rwlock' for reading with pthread_rwlock_rdlock() 15 * 3. Create a child thread, the thread locks 'rwlock' for writing, using 17 * 4. Main thread unlocks 'rwlock' 18 * 5. Main thread locks 'rwlock' for writing, using pthread_rwlock_trywrlock(), 20 * 6. Create child thread to lock 'rwlock' for writing, with pthread_rwlock_trywrlock(), 22 * 7. Main thread unlock 'rwlock' 31 static pthread_rwlock_t rwlock; variable [all …]
|
| /external/libcups/cups/ |
| D | thread.c | 110 _cupsRWInit(_cups_rwlock_t *rwlock) /* I - Reader/writer lock */ in _cupsRWInit() argument 112 pthread_rwlock_init(rwlock, NULL); in _cupsRWInit() 121 _cupsRWLockRead(_cups_rwlock_t *rwlock) /* I - Reader/writer lock */ in _cupsRWLockRead() argument 123 pthread_rwlock_rdlock(rwlock); in _cupsRWLockRead() 132 _cupsRWLockWrite(_cups_rwlock_t *rwlock)/* I - Reader/writer lock */ in _cupsRWLockWrite() argument 134 pthread_rwlock_wrlock(rwlock); in _cupsRWLockWrite() 143 _cupsRWUnlock(_cups_rwlock_t *rwlock) /* I - Reader/writer lock */ in _cupsRWUnlock() argument 145 pthread_rwlock_unlock(rwlock); in _cupsRWUnlock() 297 _cupsRWInit(_cups_rwlock_t *rwlock) /* I - Reader/writer lock */ in _cupsRWInit() argument 299 _cupsMutexInit((_cups_mutex_t *)rwlock); in _cupsRWInit() [all …]
|
| /external/rust/crates/tokio/src/sync/tests/ |
| D | loom_rwlock.rs | 1 use crate::sync::rwlock::*; 12 let rwlock = Arc::new(RwLock::<u32>::new(0)); in concurrent_write() localVariable 14 let rwclone = rwlock.clone(); in concurrent_write() 22 let rwclone = rwlock.clone(); in concurrent_write() 33 let guard = block_on(rwlock.read()); in concurrent_write() 43 let rwlock = Arc::new(RwLock::<u32>::new(0)); in concurrent_read_write() localVariable 45 let rwclone = rwlock.clone(); in concurrent_read_write() 53 let rwclone = rwlock.clone(); in concurrent_read_write() 61 let rwclone = rwlock.clone(); in concurrent_read_write() 71 let guard = block_on(rwlock.clone().read_owned()); in concurrent_read_write() [all …]
|
| /external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedwrlock/ |
| D | 1-1.c | 7 * Test that pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock) 10 * read-write lock referenced by rwlock as in the pthread_rwlock_wrlock() function. 15 * 1. Initialize rwlock 18 * 4. Main thread locks 'rwlock' for reading with pthread_rwlock_rdlock() 19 * 5. Create a child thread, the thread time-locks 'rwlock' for writing, 22 * 6. Main thread unlocks 'rwlock' 23 * 7. Main thread locks 'rwlock' for writing. 24 * 8. Create child thread to lock 'rwlock' for writing, using pthread_rwlock_timedwrlock, 26 * 8. Main thread unlocks 'rwlock' 39 static pthread_rwlock_t rwlock; variable [all …]
|
| D | 3-1.c | 7 * Test that pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock) 10 * read-write lock referenced by rwlock as in the pthread_rwlock_wrlock() function. 15 * 1. Initialize rwlock 18 * 4. Main thread locks 'rwlock' for reading with pthread_rwlock_rdlock() 19 * 5. Create a child thread, the thread time-locks 'rwlock' for writing, 22 * 6. Main thread unlocks 'rwlock' 23 * 7. Main thread locks 'rwlock' for writing. 24 * 8. Create child thread to lock 'rwlock' for writing, using pthread_rwlock_timedwrlock, 26 * 8. Main thread unlocks 'rwlock' 41 static pthread_rwlock_t rwlock; variable [all …]
|