Skip to content

Commit 7e82d19

Browse files
authored
Use AtomicBoolean instead of AtomicRef<Boolean> for LockWaiter (#2998)
It's more optimal and robust to boxing/unboxing issues.
1 parent 0c6f16b commit 7e82d19

File tree

1 file changed

+1
-1
lines changed
  • kotlinx-coroutines-core/common/src/sync

1 file changed

+1
-1
lines changed

kotlinx-coroutines-core/common/src/sync/Mutex.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ internal class MutexImpl(locked: Boolean) : Mutex, SelectClause2<Any?, Mutex> {
369369
private abstract inner class LockWaiter(
370370
@JvmField val owner: Any?
371371
) : LockFreeLinkedListNode(), DisposableHandle {
372-
private val isTaken = atomic<Boolean>(false)
372+
private val isTaken = atomic(false)
373373
fun take(): Boolean = isTaken.compareAndSet(false, true)
374374
final override fun dispose() { remove() }
375375
abstract fun tryResumeLockWaiter(): Boolean

0 commit comments

Comments
 (0)