Fix race in init

This commit is contained in:
Mygod
2020-09-20 01:32:57 +08:00
parent 45ea7a8bf3
commit 65f8d00ac4
2 changed files with 5 additions and 1 deletions

View File

@@ -99,7 +99,7 @@ abstract class IpMonitor {
} }
} }
init { protected fun init() {
thread(name = "${javaClass.simpleName}-input") { thread(name = "${javaClass.simpleName}-input") {
val mode = currentMode val mode = currentMode
if (mode.isMonitor) { if (mode.isMonitor) {

View File

@@ -57,6 +57,10 @@ class IpNeighbourMonitor private constructor() : IpMonitor() {
} }
private var neighbours = persistentMapOf<IpDev, IpNeighbour>() private var neighbours = persistentMapOf<IpDev, IpNeighbour>()
init {
init()
}
override val monitoredObject: String get() = "neigh" override val monitoredObject: String get() = "neigh"
override fun processLine(line: String) { override fun processLine(line: String) {