Remove unnecessary synchronization
This commit is contained in:
@@ -21,9 +21,7 @@ class IpNeighbourMonitor private constructor() : IpMonitor() {
|
|||||||
monitor = IpNeighbourMonitor()
|
monitor = IpNeighbourMonitor()
|
||||||
instance = monitor
|
instance = monitor
|
||||||
monitor.flush()
|
monitor.flush()
|
||||||
} else {
|
} else callback.onIpNeighbourAvailable(monitor.neighbours.values)
|
||||||
callback.onIpNeighbourAvailable(synchronized(monitor.neighbours) { monitor.neighbours.values.toList() })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fun unregisterCallback(callback: Callback) = synchronized(callbacks) {
|
fun unregisterCallback(callback: Callback) = synchronized(callbacks) {
|
||||||
if (!callbacks.remove(callback) || callbacks.isNotEmpty()) return@synchronized
|
if (!callbacks.remove(callback) || callbacks.isNotEmpty()) return@synchronized
|
||||||
|
|||||||
Reference in New Issue
Block a user