15 lines
377 B
Kotlin
15 lines
377 B
Kotlin
package com.tutpro.baresip.plus
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean
|
|
|
|
open class Event<out T>(private val content: T) {
|
|
private val hasBeenHandled = AtomicBoolean(false)
|
|
fun getContentIfNotHandled(): T? {
|
|
return if (hasBeenHandled.get()) {
|
|
null
|
|
} else {
|
|
hasBeenHandled.set(true)
|
|
content
|
|
}
|
|
}
|
|
} |