diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt index cd5bd161c..80b6c29cc 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/LockFreeLinkedList.kt @@ -132,7 +132,10 @@ open class LockFreeLinkedList { if (toRemove.isRemoved()) { continue } - toRemove.removed.value = true // logically remove: all the operations will recognize this node invalid + if (!toRemove.removed.compareAndSet(false, true)) { + // logically remove: all the operations will recognize this node invalid + continue + } // physically remove: try to fix the link