Commit 8a2027a0 authored by Him188's avatar Him188

Use volatile than atomic

parent 8117382f
......@@ -11,7 +11,6 @@
package net.mamoe.mirai.event
import kotlinx.atomicfu.atomic
import net.mamoe.mirai.event.internal.broadcastInternal
import net.mamoe.mirai.utils.MiraiExperimentalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI
......@@ -81,7 +80,9 @@ abstract class AbstractEvent : Event {
@Volatile
private var _intercepted = false
private val _cancelled = atomic(false)
@Volatile
private var _cancelled = false
// 实现 Event
/**
......@@ -103,7 +104,7 @@ abstract class AbstractEvent : Event {
/**
* @see CancellableEvent.isCancelled
*/
val isCancelled: Boolean get() = _cancelled.value
val isCancelled: Boolean get() = _cancelled
/**
* @see CancellableEvent.cancel
......@@ -112,7 +113,7 @@ abstract class AbstractEvent : Event {
check(this is CancellableEvent) {
"Event $this is not cancellable"
}
_cancelled.value = true
_cancelled = true
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment