/external/rust/crates/tokio/tests/ |
D | sync_rwlock.rs | 10 use tokio::sync::{Barrier, RwLock}; 16 let rwlock = RwLock::new(42); in into_inner() localVariable 17 assert_eq!(rwlock.into_inner(), 42); in into_inner() 23 let rwlock = RwLock::new(100); in read_shared() localVariable 25 let mut t1 = spawn(rwlock.read()); in read_shared() 27 let mut t2 = spawn(rwlock.read()); in read_shared() 34 let rwlock = RwLock::new(100); in write_shared_pending() localVariable 35 let mut t1 = spawn(rwlock.read()); in write_shared_pending() 38 let mut t2 = spawn(rwlock.write()); in write_shared_pending() 45 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/tokio/src/sync/ |
D | rwlock.rs | 37 /// become available to yield. An `RwLock` will allow any number of readers to 46 /// `std::sync::RwLock`, where the priority policy is dependent on the 58 /// use tokio::sync::RwLock; 62 /// let lock = RwLock::new(5); 82 /// [`RwLock`]: struct@RwLock 88 pub struct RwLock<T: ?Sized> { struct 108 check_send::<RwLock<u32>>(); in bounds() argument 109 check_sync::<RwLock<u32>>(); in bounds() 110 check_unpin::<RwLock<u32>>(); in bounds() 136 let rwlock = Arc::new(RwLock::new(0)); in bounds() localVariable [all …]
|
/external/rust/crates/lock_api/src/ |
D | rwlock.rs | 22 /// Types implementing this trait can be used by `RwLock` to form a safe and 23 /// fully-functioning `RwLock` type. 27 /// Implementations of this trait must ensure that the `RwLock` is actually 32 /// Initial value for an unlocked `RwLock`. 68 /// Checks if this `RwLock` is currently locked in any way. 172 /// to recursively lock a `RwLock`. However using this method can cause 311 pub struct RwLock<R, T: ?Sized> { struct 318 impl<R, T> Serialize for RwLock<R, T> implementation 332 impl<'de, R, T> Deserialize<'de> for RwLock<R, T> implementation 341 Deserialize::deserialize(deserializer).map(RwLock::new) in deserialize() [all …]
|
/external/rust/crates/spin/src/ |
D | rw_lock.rs | 13 /// This lock behaves in a similar manner to its namesake `std::sync::RwLock` but uses 47 /// let lock = spin::RwLock::new(5); 64 pub struct RwLock<T: ?Sized> { struct 78 inner: &'a RwLock<T>, argument 86 inner: &'a RwLock<T>, 99 inner: &'a RwLock<T>, 103 // Same unsafe impls as `std::sync::RwLock` 104 unsafe impl<T: ?Sized + Send> Send for RwLock<T> {} implementation 105 unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {} implementation 107 impl<T> RwLock<T> { implementation [all …]
|
/external/llvm-project/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/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_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_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_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/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_timedrdlock/ |
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 | 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 | 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/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/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/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 …]
|
/external/rust/crates/parking_lot/ |
D | README.md | 13 This library provides implementations of `Mutex`, `RwLock`, `Condvar` and 21 contended from multiple threads. The numbers for `RwLock` vary depending on 23 the standard library `RwLock`, and even up to 50x faster in some cases. 31 and `RwLock` only require 1 word of storage space. On the other hand the 49 6. `Condvar`, `RwLock` and `Once` work on Windows XP, unlike the standard 51 7. `RwLock` takes advantage of hardware lock elision on processors that 53 8. `RwLock` uses a task-fair locking policy, which avoids reader and writer 60 11. `RwLock` supports atomically downgrading a write lock into a read lock. 61 12. `Mutex` and `RwLock` allow raw unlocking without a RAII guard object. 62 13. `Mutex<()>` and `RwLock<()>` allow raw locking without a RAII guard [all …]
|