Home
last modified time | relevance | path

Searched refs:compareAndSet (Results 1 – 25 of 138) sorted by relevance

123456

/external/kotlinx.atomicfu/atomicfu/src/commonMain/kotlin/kotlinx/atomicfu/
DAtomicFU.common.kt80 public fun compareAndSet(expect: T, update: T): Boolean in atomic() method in kotlinx.atomicfu.AtomicRef
104 if (compareAndSet(cur, upd)) return in update()
115 if (compareAndSet(cur, upd)) return cur in getAndUpdate()
126 if (compareAndSet(cur, upd)) return upd in updateAndGet()
152 public fun compareAndSet(expect: Boolean, update: Boolean): Boolean in lazySet() method in kotlinx.atomicfu.AtomicBoolean
177 if (compareAndSet(cur, upd)) return in update()
188 if (compareAndSet(cur, upd)) return cur in getAndUpdate()
199 if (compareAndSet(cur, upd)) return upd in updateAndGet()
224 public fun compareAndSet(expect: Int, update: Int): Boolean in lazySet() method in kotlinx.atomicfu.AtomicInt
288 if (compareAndSet(cur, upd)) return in update()
[all …]
/external/kotlinx.atomicfu/atomicfu/src/nativeMain/kotlin/kotlinx/atomicfu/locks/
DSynchronized.kt21 if (lock.compareAndSet(state, thinLock)) in lock()
28 if (lock.compareAndSet(state, thinNested)) in lock()
35 if (lock.compareAndSet(state, fatLock)) { in lock()
51 if (lock.compareAndSet(state, nestedFatLock)) return in lock()
54 if (lock.compareAndSet(state, fatLock)) { in lock()
71 if (lock.compareAndSet(state, thinLock)) in tryLock()
76 if (lock.compareAndSet(state, nestedLock)) in tryLock()
95 if (lock.compareAndSet(state, unlocked)) in unlock()
100 if (lock.compareAndSet(state, releasedNestedLock)) in unlock()
108 if (lock.compareAndSet(state, releasedLock)) { in unlock()
[all …]
/external/kotlinx.atomicfu/atomicfu/src/nativeMain/kotlin/kotlinx/atomicfu/
DAtomicFU.kt36 public actual inline fun compareAndSet(expect: T, update: T): Boolean { in atomic() method in kotlinx.atomicfu.AtomicRef
38 return a.compareAndSet(expect, update) in atomic()
63 public actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean { in compareAndSet() method in kotlinx.atomicfu.AtomicBoolean
66 return a.compareAndSet(iExpect, iUpdate) in compareAndSet()
74 if (a.compareAndSet(cur, iValue)) return cur != 0 in getAndSet()
91 public actual inline fun compareAndSet(expect: Int, update: Int): Boolean = in toString() method in kotlinx.atomicfu.AtomicInt
92 a.compareAndSet(expect, update) in toString()
98 if (a.compareAndSet(cur, value)) return cur in toString()
125 public actual inline fun compareAndSet(expect: Long, update: Long): Boolean = in compareAndSet() method in kotlinx.atomicfu.AtomicLong
126 a.compareAndSet(expect, update) in compareAndSet()
[all …]
/external/kotlinx.atomicfu/atomicfu/src/commonTest/kotlin/kotlinx/atomicfu/test/
DAtomicArrayTest.kt14 check(A.intArr[0].compareAndSet(0, 3)) in testIntArray()
18 check(A.intArr[0].compareAndSet(5, 10)) in testIntArray()
23 check(A.intArr[2].compareAndSet(2, 34)) in testIntArray()
61 A.booleanArr[1].compareAndSet(false, true) in testBooleanArray()
76 check(A.refArr[0].compareAndSet(a2, a3)) in testRefArray()
82 check(A.refArr[3].compareAndSet(a3, a)) in testRefArray()
87 check(A.genericArr[2].compareAndSet(l1, l2)) in testRefArray()
96 check(ea.stringAtomicNullArray[0].compareAndSet(null, "aaa")) in extendedApiTest()
102 check(ea.genAtomicNullArr[3].compareAndSet(null, l1)) in extendedApiTest()
104 check(ea.genAtomicNullArr[3].compareAndSet(l1, l2)) in extendedApiTest()
DTopLevelTest.kt29 check(a.compareAndSet(3, 8)) in <lambda>()
46 a.compareAndSet(7, 10) in <lambda>()
76 check(c.compareAndSet(true, false)) in <lambda>()
94 check(stringAtomicNullArr[0].compareAndSet(null, "aa")) in <lambda>()
103 check(intArr[0].compareAndSet(0, 3)) in testIntArray()
107 check(intArr[0].compareAndSet(5, 10)) in testIntArray()
112 check(intArr[2].compareAndSet(2, 34)) in testIntArray()
148 booleanArr[1].compareAndSet(false, true) in testBooleanArray()
161 check(refArr[0].compareAndSet(a2, a3)) in testRefArray()
167 check(refArr[3].compareAndSet(a3, a)) in testRefArray()
[all …]
DSetArrayElementTest.kt33 fun setInt(index: Int, data: Int) = intArr[index].compareAndSet(0, data) in setInt()
34 fun setBoolean(index: Int, data: Boolean) = booleanArr[index].compareAndSet(false, data) in setInt()
35 fun setRef(index: Int, data: ARef) = refArr[index].compareAndSet(null, data) in setInt()
42 val result = refArray[index].compareAndSet(null, data) in setInt()
DLockFreeQueueTest.kt40 tail.compareAndSet(curTail, curNext) in enqueue()
43 if (curTail.next.compareAndSet(null, node)) { in enqueue()
44 tail.compareAndSet(curTail, node) in enqueue()
53 if (head.compareAndSet(curHead, next)) return next.value in dequeue()
/external/kotlinx.coroutines/kotlinx-coroutines-core/jvm/src/internal/
DLockFreeLinkedList.kt78 if (update != null && affected._next.compareAndSet( this, update)) { in <lambda>()
125 if (_next.compareAndSet(this, node)) { in <lambda>()
213 if (!_next.compareAndSet(next, node)) return false in <lambda>()
225 if (!_next.compareAndSet(next, condAdd)) return UNDECIDED in <lambda>()
251 if (_next.compareAndSet(next, removed)) { in <lambda>()
333 _affectedNode.compareAndSet(null, prepareOp.affected) in <lambda>()
339 node._prev.compareAndSet(node, affected) in <lambda>()
340 node._next.compareAndSet(node, queue) in <lambda>()
387 _affectedNode.compareAndSet(null, prepareOp.affected) in <lambda>()
388 _originalNext.compareAndSet(null, prepareOp.next) in <lambda>()
[all …]
/external/kotlinx.coroutines/kotlinx-coroutines-core/common/src/sync/
DMutex.kt174 if (_state.compareAndSet(state, update)) return true in toString()
199 _state.compareAndSet(state, LockedQueue(state.locked)) in toString()
203 if (_state.compareAndSet(state, update)) { // locked in toString()
235 _state.compareAndSet(state, LockedQueue(state.locked)) in toString()
274 (affected as MutexImpl)._state.compareAndSet(this, update) in toString()
281 if (!mutex._state.compareAndSet(EMPTY_UNLOCKED, prepare)) return LOCK_FAIL in toString()
289 mutex._state.compareAndSet(op, update) in toString()
310 if (_state.compareAndSet(state, EMPTY_UNLOCKED)) return in toString()
319 if (_state.compareAndSet(state, op) && op.perform(this) == null) return in toString()
396 affected._state.compareAndSet(this, update) in toString()
/external/kotlinx.coroutines/kotlinx-coroutines-core/common/src/channels/
DConflatedBroadcastChannel.kt112 if (_state.compareAndSet(state, update)) in <lambda>()
127 if (_state.compareAndSet(state, update)) in <lambda>()
166 if (_state.compareAndSet(state, update)) { in <lambda>()
180 && onCloseHandler.compareAndSet(handler, HANDLER_INVOKED)) { in <lambda>()
188 if (!onCloseHandler.compareAndSet(null, handler)) { in <lambda>()
197 if (state is Closed && onCloseHandler.compareAndSet(handler, HANDLER_INVOKED)) { in <lambda>()
244 if (!_updating.compareAndSet(0, 1)) return null in <lambda>()
251 if (_state.compareAndSet(state, update)) { in <lambda>()
/external/kotlinx.coroutines/kotlinx-coroutines-core/common/src/flow/
DStateFlow.kt174 public fun compareAndSet(expect: T, update: T): Boolean in compareAndSet() method
225 if (_state.compareAndSet(state, PENDING)) return in compareAndSet()
229 if (_state.compareAndSet(state, NONE)) { in compareAndSet()
246 … if (_state.compareAndSet(NONE, cont)) return@sc // installed continuation, waiting for pending in compareAndSet()
264 override fun compareAndSet(expect: T, update: T): Boolean = in compareAndSet() method
365 if (compareAndSet(current, current + delta)) return in createSlot()
/external/guava/guava-tests/test/com/google/common/util/concurrent/
DAtomicDoubleTest.java90 assertFalse(at.compareAndSet(unused, x)); in testCompareAndSet()
92 assertTrue(at.compareAndSet(prev, x)); in testCompareAndSet()
107 while (!at.compareAndSet(2.0, 3.0)) { in testCompareAndSetInMultipleThreads()
113 assertTrue(at.compareAndSet(1.0, 2.0)); in testCompareAndSetInMultipleThreads()
238 assertFalse(at.compareAndSet(-0.0, 7.0)); in testDistinctZeros()
241 assertTrue(at.compareAndSet(+0.0, -0.0)); in testDistinctZeros()
243 assertFalse(at.compareAndSet(+0.0, 7.0)); in testDistinctZeros()
DAtomicDoubleArrayTest.java120 aa.compareAndSet(index, 1.0, 2.0); in testIndexing()
174 assertFalse(aa.compareAndSet(i, unused, x)); in testCompareAndSet()
176 assertTrue(aa.compareAndSet(i, prev, x)); in testCompareAndSet()
193 while (!a.compareAndSet(0, 2.0, 3.0)) { in testCompareAndSetInMultipleThreads()
199 assertTrue(a.compareAndSet(0, 1.0, 2.0)); in testCompareAndSetInMultipleThreads()
283 if (aa.compareAndSet(i, v, v - 1.0)) { in realRun()
349 assertFalse(aa.compareAndSet(i, -0.0, 7.0)); in testDistinctZeros()
352 assertTrue(aa.compareAndSet(i, +0.0, -0.0)); in testDistinctZeros()
354 assertFalse(aa.compareAndSet(i, +0.0, 7.0)); in testDistinctZeros()
/external/guava/android/guava-tests/test/com/google/common/util/concurrent/
DAtomicDoubleTest.java90 assertFalse(at.compareAndSet(unused, x)); in testCompareAndSet()
92 assertTrue(at.compareAndSet(prev, x)); in testCompareAndSet()
106 while (!at.compareAndSet(2.0, 3.0)) { in testCompareAndSetInMultipleThreads()
112 assertTrue(at.compareAndSet(1.0, 2.0)); in testCompareAndSetInMultipleThreads()
237 assertFalse(at.compareAndSet(-0.0, 7.0)); in testDistinctZeros()
240 assertTrue(at.compareAndSet(+0.0, -0.0)); in testDistinctZeros()
242 assertFalse(at.compareAndSet(+0.0, 7.0)); in testDistinctZeros()
DAtomicDoubleArrayTest.java120 aa.compareAndSet(index, 1.0, 2.0); in testIndexing()
174 assertFalse(aa.compareAndSet(i, unused, x)); in testCompareAndSet()
176 assertTrue(aa.compareAndSet(i, prev, x)); in testCompareAndSet()
192 while (!a.compareAndSet(0, 2.0, 3.0)) { in testCompareAndSetInMultipleThreads()
198 assertTrue(a.compareAndSet(0, 1.0, 2.0)); in testCompareAndSetInMultipleThreads()
281 if (aa.compareAndSet(i, v, v - 1.0)) { in realRun()
347 assertFalse(aa.compareAndSet(i, -0.0, 7.0)); in testDistinctZeros()
350 assertTrue(aa.compareAndSet(i, +0.0, -0.0)); in testDistinctZeros()
352 assertFalse(aa.compareAndSet(i, +0.0, 7.0)); in testDistinctZeros()
/external/kotlinx.atomicfu/atomicfu/src/jvmMain/kotlin/kotlinx/atomicfu/
DAtomicFU.kt90 public actual fun compareAndSet(expect: T, update: T): Boolean { in atomic() method
92 val result = FU.compareAndSet(this, expect, update) in atomic()
152 public actual fun compareAndSet(expect: Boolean, update: Boolean): Boolean { in compareAndSet() method
156 val result = FU.compareAndSet(this, e, u) in compareAndSet()
210 public actual fun compareAndSet(expect: Int, update: Int): Boolean { in compareAndSet() method
212 val result = FU.compareAndSet(this, expect, update) in compareAndSet()
339 public actual fun compareAndSet(expect: Long, update: Long): Boolean { in compareAndSet() method
341 val result = FU.compareAndSet(this, expect, update) in compareAndSet()
/external/kotlinx.coroutines/kotlinx-coroutines-core/common/src/
DCancellableContinuationImpl.kt164 if (_state.compareAndSet(state, update)) { in <lambda>()
172 … if (_state.compareAndSet(state, CompletedContinuation(state, cancelCause = cause))) { in <lambda>()
193 if (!_state.compareAndSet(state, update)) return@loop // retry on cas failure in <lambda>()
253 UNDECIDED -> if (this._decision.compareAndSet(UNDECIDED, SUSPENDED)) return true in <lambda>()
263 UNDECIDED -> if (this._decision.compareAndSet(UNDECIDED, RESUMED)) return true in <lambda>()
303 if (_state.compareAndSet(state, cancelHandler)) return // quit on cas success in <lambda>()
336 if (_state.compareAndSet(state, update)) return // quit on cas success in <lambda>()
346 if (_state.compareAndSet(state, update)) return // quit on cas success in <lambda>()
394 if (!_state.compareAndSet(state, update)) return@loop // retry on cas failure in <lambda>()
429 if (!_state.compareAndSet(state, update)) return@loop // retry on cas failure in <lambda>()
DEventLoop.common.kt296 null -> if (_queue.compareAndSet(null, task)) return true in enqueueImpl()
301 Queue.ADD_FROZEN -> _queue.compareAndSet(queue, queue.next()) in enqueueImpl()
311 if (_queue.compareAndSet(queue, newQueue)) return true in enqueueImpl()
326 _queue.compareAndSet(queue, queue.next()) in dequeue()
330 else -> if (_queue.compareAndSet(queue, null)) return queue as Runnable in dequeue()
340 null -> if (_queue.compareAndSet(null, CLOSED_EMPTY)) return in closeQueue()
351 if (_queue.compareAndSet(queue, newQueue)) return in closeQueue()
373 _delayed.compareAndSet(null, DelayedTaskQueue(now)) in shouldUnpark()
/external/kotlinx.atomicfu/atomicfu/src/commonTest/kotlin/internal_test1/
DB.kt20 check(a.yyy.compareAndSet(638753975930025820, 3444)) in testInternal()
22 check(a.intArr[2].compareAndSet(0, 6)) in testInternal()
24 check(a.refArr[3].compareAndSet(null, "OK")) in testInternal()
/external/kotlinx.coroutines/kotlinx-coroutines-core/common/src/selects/
DSelect.kt283 if (_result.compareAndSet(UNDECIDED, update)) return in next()
285 … result === COROUTINE_SUSPENDED -> if (_result.compareAndSet(COROUTINE_SUSPENDED, RESUMED)) { in next()
317 if (_result.compareAndSet(UNDECIDED, COROUTINE_SUSPENDED)) return COROUTINE_SUSPENDED in next()
491 if (!_state.compareAndSet(NOT_SELECTED, null)) return@loop in next()
495 if (!_state.compareAndSet(NOT_SELECTED, pairSelectOp)) return@loop in next()
552 impl._state.compareAndSet(this, update) in next()
603 if (impl._state.compareAndSet(NOT_SELECTED, this)) in next()
613 impl._state.compareAndSet(this, NOT_SELECTED) in next()
619 if (impl._state.compareAndSet(this, update)) { in next()
/external/guava/android/guava/src/com/google/common/util/concurrent/
DAtomicDouble.java121 public final boolean compareAndSet(double expect, double update) { in compareAndSet() method in AtomicDouble
122 return value.compareAndSet(doubleToRawLongBits(expect), doubleToRawLongBits(update)); in compareAndSet()
155 if (value.compareAndSet(current, next)) { in getAndAdd()
174 if (value.compareAndSet(current, next)) { in addAndGet()
DInterruptibleTask.java60 if (!compareAndSet(null, currentThread)) { in run()
75 if (!compareAndSet(currentThread, DONE)) { in run()
103 if (state == PARKED || compareAndSet(INTERRUPTING, PARKED)) { in run()
165 if (currentRunner instanceof Thread && compareAndSet(currentRunner, INTERRUPTING)) { in interruptTask()
/external/guava/guava/src/com/google/common/util/concurrent/
DInterruptibleTask.java60 if (!compareAndSet(null, currentThread)) { in run()
75 if (!compareAndSet(currentThread, DONE)) { in run()
103 if (state == PARKED || compareAndSet(INTERRUPTING, PARKED)) { in run()
165 if (currentRunner instanceof Thread && compareAndSet(currentRunner, INTERRUPTING)) { in interruptTask()
DAtomicDouble.java127 public final boolean compareAndSet(double expect, double update) { in compareAndSet() method in AtomicDouble
128 return updater.compareAndSet(this, doubleToRawLongBits(expect), doubleToRawLongBits(update)); in compareAndSet()
162 if (updater.compareAndSet(this, current, next)) { in getAndAdd()
181 if (updater.compareAndSet(this, current, next)) { in addAndGet()
/external/kotlinx.coroutines/kotlinx-coroutines-core/common/src/internal/
DDispatchedContinuation.kt107 if (_reusableCancellableContinuation.compareAndSet(state, REUSABLE_CLAIMED)) { in <lambda>()
135 … if (_reusableCancellableContinuation.compareAndSet(REUSABLE_CLAIMED, continuation)) return null in <lambda>()
139 require(_reusableCancellableContinuation.compareAndSet(state, null)) in <lambda>()
155 if (_reusableCancellableContinuation.compareAndSet(REUSABLE_CLAIMED, cause)) in <lambda>()
161 if (_reusableCancellableContinuation.compareAndSet(state, null)) in <lambda>()

123456