/commonlibrary/rust/ylong_runtime/ylong_runtime/benches/ |
H A D | ylong_tokio_rwlock.rs | 52 let lock = Arc::new(RwLock::new(())); in tokio_rwlock_read() 56 let lock = lock.clone(); in tokio_rwlock_read() 57 handlers.push(rt.spawn(tokio_rwlock_task(lock.clone()))); in tokio_rwlock_read() 77 let lock = Arc::new(YlongRwlock::new(())); in ylong_rwlock_read() 81 let lock = lock.clone(); in ylong_rwlock_read() 82 handlers.push(ylong_runtime::spawn(ylong_rwlock_task(lock.clone()))); in ylong_rwlock_read() 101 let lock = Arc::new(RwLock::new(())); in tokio_rwlock_write() 105 let lock in tokio_rwlock_write() [all...] |
H A D | ylong_tokio_mutex.rs | 42 let mut lock = mutex1.lock().await; variables 43 *lock += 1; 52 let n = mutex.lock().await; 72 let mut lock = mutex1.lock().await; variables 73 *lock += 1; 82 let n = mutex.lock().await;
|
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/sync/ |
H A D | rwlock.rs | 41 /// let lock = RwLock::new(0); 44 /// let r1 = lock.read().await; 45 /// let r2 = lock.read().await; 50 /// // Only one write lock at a time 51 /// let mut w = lock.write().await; 77 /// let lock = RwLock::new(0); 93 /// Asynchronously acquires the read lock. 95 /// If there is a writer holding the write lock, then this method will wait 96 /// asynchronously for the write lock to get released. 98 /// But if the write lock i [all...] |
H A D | mutex.rs | 51 write!(f, "Try lock error.") in fmt() 90 /// let lock = Arc::new(Mutex::new(2)); 91 /// let mut n = lock.lock().await; 96 pub async fn lock(&self) -> MutexGuard<'_, T> { 105 /// If the lock is already held by others, LockError will be returned. 118 /// Ok(lock) => println!("{}", lock), 130 /// Gets the mutable reference of the data protected by the lock without 131 /// actually holding the lock 218 let mut lock = mutex.lock().await; ut_mutex_lock_01() variables 234 let mut lock = mutex.try_lock().unwrap(); ut_mutex_try_lock_01() variables [all...] |
H A D | wake_list.rs | 38 /// However, we lock `WakerList` first when we try to access it. So it is safe 56 let mut list = self.lock(); in insert() 63 let mut inner = self.lock(); in remove() 69 /// non-atomic operation is required, call `lock` first and then call 78 /// required, call `lock` first and then call `notify_all`. 86 let mut inner = self.lock(); in notify() 94 /// fetch the lock. 95 pub fn lock(&self) -> Lock<'_> { in lock() functions
|
/commonlibrary/c_utils/base/include/ |
H A D | safe_block_queue.h | 60 std::unique_lock<std::mutex> lock(mutexLock_); in Push() 63 cvNotFull_.wait(lock, [&]() { return (queueT_.size() < maxSize_); }); in Push() 82 std::unique_lock<std::mutex> lock(mutexLock_); in Pop() 86 cvNotEmpty_.wait(lock, [&] { return !queueT_.empty(); }); in Pop() 107 std::unique_lock<std::mutex> lock(mutexLock_); in PushNoWait() 129 std::unique_lock<std::mutex> lock(mutexLock_); in PopNotWait() 143 std::unique_lock<std::mutex> lock(mutexLock_); in Size() 149 std::unique_lock<std::mutex> lock(mutexLock_); in IsEmpty() 155 std::unique_lock<std::mutex> lock(mutexLock_); in IsFull() 195 std::unique_lock<std::mutex> lock(mutexLock in Push() [all...] |
H A D | safe_map.h | 45 std::lock_guard<std::mutex> lock(mutex_); in operator =() 53 std::lock_guard<std::mutex> lock(mutex_); in ReadVal() 60 std::lock_guard<std::mutex> lock(mutex_); in ChangeValueByLambda() 73 std::lock_guard<std::mutex> lock(mutex_); in Size() 89 std::lock_guard<std::mutex> lock(mutex_); in IsEmpty() 103 std::lock_guard<std::mutex> lock(mutex_); in Insert() 118 std::lock_guard<std::mutex> lock(mutex_); in EnsureInsert() 140 std::lock_guard<std::mutex> lock(mutex_); in Find() 163 std::lock_guard<std::mutex> lock(mutex_); in FindOldAndSetNew() 184 std::lock_guard<std::mutex> lock(mutex in Erase() [all...] |
H A D | safe_queue.h | 53 std::lock_guard<std::mutex> lock(mutex_); in Erase() 64 std::lock_guard<std::mutex> lock(mutex_); in Empty() 70 std::lock_guard<std::mutex> lock(mutex_); in Push() 76 std::lock_guard<std::mutex> lock(mutex_); in Clear() 86 std::lock_guard<std::mutex> lock(mutex_); in Size() 92 std::lock_guard<std::mutex> lock(mutex_); in Pop()
|
/commonlibrary/ets_utils/js_concurrent_module/worker/ |
H A D | message_queue.cpp | 22 queueLock_.lock();
in EnQueue() 29 queueLock_.lock();
in DeQueue() 51 queueLock_.lock();
in Clear() 63 std::unique_lock<std::mutex> lock(queueLock_);
in Push() 69 std::unique_lock<std::mutex> lock(queueLock_);
in Pop() 75 std::unique_lock<std::mutex> lock(queueLock_);
in Front() 81 std::unique_lock<std::mutex> lock(queueLock_);
in IsEmpty() 87 std::unique_lock<std::mutex> lock(queueLock_);
in Clear()
|
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/time/ |
H A D | driver.rs | 54 let mut lock = self.wheel.lock().unwrap(); variables 55 lock.insert(clock_entry) 59 let mut lock = self.wheel.lock().unwrap(); variables 60 lock.cancel(clock_entry); 102 let mut lock = self.wheel.lock().unwrap(); variables 107 match lock.poll(now) { 120 drop(lock); [all...] |
/commonlibrary/c_utils/base/src/ |
H A D | observer.cpp | 28 lock_guard<mutex> lock(mutex_); in AddObserver() 38 lock_guard<mutex> lock(mutex_); in RemoveObserver() 44 lock_guard<mutex> lock(mutex_); in RemoveAllObservers() 55 lock_guard<mutex> lock(mutex_); in GetObserversCount() 68 lock_guard<mutex> lock(mutex_); in NotifyObservers()
|
H A D | thread_pool.cpp | 64 std::unique_lock<std::mutex> lock(mutex_); in Stop() 79 std::unique_lock<std::mutex> lock(mutex_); in AddTask() 81 acceptNewTask_.wait(lock); in AddTask() 91 std::unique_lock<std::mutex> lock(mutex_); in GetCurTaskNum() 98 std::unique_lock<std::mutex> lock(mutex_); in ScheduleTask() 100 hasTaskToDo_.wait(lock); in ScheduleTask()
|
/commonlibrary/memory_utils/libpurgeablemem/cpp/src/ |
H A D | purgeable_mem_base.cpp | 56 std::lock_guard<std::mutex> lock(dataLock_); in BeginRead() 100 std::lock_guard<std::mutex> lock(dataLock_); in EndRead() 111 std::lock_guard<std::mutex> lock(dataLock_); in BeginWrite() 145 std::lock_guard<std::mutex> lock(dataLock_); in EndWrite() 153 std::lock_guard<std::mutex> lock(dataLock_); in ModifyContentByBuilder() 181 std::lock_guard<std::mutex> lock(dataLock_); in GetContent() 187 std::lock_guard<std::mutex> lock(dataLock_); in GetContentSize() 238 std::lock_guard<std::mutex> lock(dataLock_); in SetRebuildSuccessCallback() 246 std::lock_guard<std::mutex> lock(dataLock_); in IsDataValid() 252 std::lock_guard<std::mutex> lock(dataLock in SetDataValid() [all...] |
/commonlibrary/rust/ylong_runtime/ylong_signal/src/ |
H A D | spin_rwlock.rs | 23 //! by a lock to ensure atomicity. However, we could not use the regular 24 //! [`std::sync::RwLock`] because this lock is not async-signal-safe. 101 let guard = self.write_lock.lock().unwrap(); 105 lock: self, 139 lock: &'a SpinningRwLock<T>, 151 self.lock.data[new_version].store(val_ptr, Ordering::SeqCst); 152 self.lock.version.store(new_version, Ordering::SeqCst); 154 let old_data = self.lock.data[old_version].swap(null_mut(), Ordering::SeqCst); 155 self.lock.wait_version_release(old_version); 170 let data = self.lock in deref() [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/src/executor/ |
H A D | current_thread.rs | 60 let mut queue = self.inner.lock().unwrap(); in schedule() 65 let parker_list = self.parker_list.lock().unwrap(); in schedule() 74 let mut queue = self.inner.lock().unwrap(); in pop() 143 let mut lock = self.mutex.lock().unwrap(); in park_on_condvar() variables 161 while !*lock { in park_on_condvar() 162 lock = self.condvar.wait(lock).unwrap(); in park_on_condvar() 164 *lock = false; in park_on_condvar() 178 let mut lock in unpark() variables 191 let mut lock = self.mutex.lock().unwrap(); unpark() variables [all...] |
H A D | blocking_pool.rs | 77 let mut shared = self.inner.shared.lock().unwrap(); in shutdown() 86 let shutdown_shared = self.inner.shutdown_shared.lock().unwrap(); in shutdown() 172 let mut shared = self.inner.shared.lock().unwrap(); in create_permanent_threads() 208 let mut shared = self.inner.shared.lock().unwrap(); in spawn() 341 let mut shared = self.shared.lock().unwrap(); in run() 347 shared = self.shared.lock().unwrap(); in run() 360 shared = self.shared.lock().unwrap(); in run() 380 *self.shutdown_shared.lock().unwrap() = true; in run() 458 blocking_pool.inner.shared.lock().unwrap().shutdown = true; in ut_blocking_pool_shutdown() 465 *spawner_inner_clone.shutdown_shared.lock() in ut_blocking_pool_shutdown() [all...] |
H A D | sleeper.rs | 35 let idle_list = self.idle_list.lock().unwrap(); in is_parked() 40 let mut idle_list = self.idle_list.lock().unwrap(); in pop_worker_by_id() 57 let mut idle_list = self.idle_list.lock().unwrap(); in pop_worker() 63 let mut search_list = self.wake_by_search.lock().unwrap(); in pop_worker() 74 let mut idle_list = self.idle_list.lock().unwrap(); in push_worker()
|
/commonlibrary/rust/ylong_runtime/ylong_runtime/tests/ |
H A D | mutex.rs | 31 /// SDV test cases for Mutex::lock() interface 35 /// 2. Make a concurrent process obtain a concurrent mutex lock and sleep after 36 /// obtaining it to hold the lock for a long time. 38 /// operation, and then modifies the value in the lock after obtaining the 39 /// lock. 40 /// 4. Check the value in the lock. 46 let mut lock = mutex1.lock().await; in sdv_mutex_lock_hold_longtime() variables 47 *lock += 1; in sdv_mutex_lock_hold_longtime() 52 let mut lock2 = mutex.lock() in sdv_mutex_lock_hold_longtime() [all...] |
/commonlibrary/ets_utils/js_concurrent_module/taskpool/ |
H A D | task_manager.cpp | 97 std::lock_guard<RECURSIVE_MUTEX> lock(workersMutex_); in ~TaskManager() 105 std::lock_guard<std::mutex> lock(callbackMutex_); in ~TaskManager() 116 std::lock_guard<RECURSIVE_MUTEX> lock(tasksMutex_); in ~TaskManager() 128 std::lock_guard<RECURSIVE_MUTEX> lock(workersMutex_); in CountTraceForWorker() 143 std::lock_guard<RECURSIVE_MUTEX> lock(workersMutex_); in GetThreadInfos() 156 std::lock_guard<std::mutex> lock(worker->currentTaskIdMutex_); in GetThreadInfos() 180 std::lock_guard<RECURSIVE_MUTEX> lock(tasksMutex_); in GetTaskInfos() 188 std::lock_guard<RECURSIVE_MUTEX> lock(task->taskMutex_); in GetTaskInfos() 241 std::lock_guard<RECURSIVE_MUTEX> lock(workersMutex_); in CheckForBlockedWorkers() 328 std::lock_guard<RECURSIVE_MUTEX> lock(workersMutex in GetIdleWorkers() [all...] |
H A D | message_queue.h | 28 std::lock_guard<std::mutex> lock(queueLock_);
in EnQueue() 34 std::lock_guard<std::mutex> lock(queueLock_);
in DeQueue() 46 std::lock_guard<std::mutex> lock(queueLock_);
in IsEmpty()
|
/commonlibrary/rust/ylong_runtime/ylong_runtime/benches/task_helpers/ |
H A D | mod.rs | 113 pub async fn ylong_rwlock_write_task(lock: Arc<YlongRwlock<()>>) { 114 let _read = lock.write().await; 118 pub async fn ylong_rwlock_task(lock: Arc<YlongRwlock<()>>) { 119 let _read = lock.read().await; 122 pub async fn tokio_rwlock_write_task(lock: Arc<RwLock<()>>) { 123 let _read = lock.write().await; 126 pub async fn tokio_rwlock_task(lock: Arc<RwLock<()>>) { 127 let _read = lock.read().await;
|
/commonlibrary/ets_utils/js_concurrent_module/utils/locks/ |
H A D | lock_request.cpp | 29 LockRequest::LockRequest(AsyncLock *lock, tid_t tid, napi_env env, napi_ref cb, LockMode mode, in LockRequest() argument 31 : lock_(lock), in LockRequest() 44 RequestTimeoutData *data = new RequestTimeoutData(lock, this); in LockRequest() 94 lockRequest->lockRequestMutex_.lock(); in AsyncAfterWorkCallback() 122 lockRequestMutex_.lock(); in CallCallbackAsync() 159 // the lock request will be destroyed during napi_call_function(finallyFn). in CallCallback() 160 AsyncLock *lock = lock_; in CallCallback() local 162 // Increament reference counter for the lock. Do it to prevent lock destruction. in CallCallback() 163 lock in CallCallback() 255 AsyncLock *lock = data->lock; TimeoutCallback() local [all...] |
H A D | async_lock.cpp | 46 std::unique_lock<std::mutex> lock(asyncLockMutex_); in LockAsync() 49 NAPI_CALL(env, napi_create_string_utf8(env, "The lock is acquired", NAPI_AUTO_LENGTH, &err)); in LockAsync() 61 std::unique_lock<std::mutex> lock(asyncLockMutex_); in CleanUpLockRequestOnCompletion() 69 // There are may be other shared lock requests in the heldList_. in CleanUpLockRequestOnCompletion() 80 std::unique_lock<std::mutex> lock(asyncLockMutex_); in CleanUpLockRequestOnTimeout() 83 // the lock got held while we were waiting on the mutex, no-op in CleanUpLockRequestOnTimeout() 103 asyncLockMutex_.lock(); in ProcessLockRequest() 108 std::unique_lock<std::mutex> lock(asyncLockMutex_); in ProcessPendingLockRequest() 116 // No more refs to the lock. We need to delete the instance but we cannot do it right now in ProcessPendingLockRequestUnsafe() 160 std::unique_lock<std::mutex> lock(asyncLockMutex in FillLockState() [all...] |
/commonlibrary/rust/ylong_runtime/ylong_runtime/benches/bin/ |
H A D | ylong_sync_mutex_perf.rs | 27 let mut lock = mutex.lock().await; in main() variables 28 *lock += 1; in main()
|
/commonlibrary/rust/ylong_http/ylong_http_client/src/util/ |
H A D | alt_svc.rs | 46 let mut lock = self.inner.lock().unwrap(); variables 47 let vec = lock.get_mut(key)?; 99 let mut lock = self.inner.lock().unwrap(); variables 118 lock.remove(&key); 128 lock.insert(key, new_alt_svcs);
|