vineethraj49
08/14/2020, 1:25 PMvineethraj49
08/14/2020, 1:28 PMreturn synchronized(lock) {
val _v2 = _value
if (_v2 !== UNINITIALIZED_VALUE) {
@Suppress("UNCHECKED_CAST") (_v2 as T)
} else {
val typedValue = initializer!!() <-- gets till this invocation and then blocked
_value = typedValue
initializer = null
typedValue
}
}streetsofboston
08/14/2020, 1:32 PMlazy delegate….vineethraj49
08/14/2020, 1:33 PMstreetsofboston
08/14/2020, 1:35 PMconcurrency value to 64 (or a bit less)?vineethraj49
08/14/2020, 1:35 PMvineethraj49
08/14/2020, 1:36 PMvineethraj49
08/14/2020, 1:36 PMstreetsofboston
08/14/2020, 1:36 PMlazy{ .. } is executed for the lz variable that can’t finish, since there are no threads left to run that test function…streetsofboston
08/14/2020, 1:39 PMasync were to be scheduled in a bit more sequential fashion, not all 64 IO threads would be unavailable?
What happens if you don’t make lz lazy, but just val lz = Obj()?vineethraj49
08/14/2020, 1:42 PMvineethraj49
08/14/2020, 1:45 PMwasyl
08/14/2020, 1:50 PMDeferred instead?vineethraj49
08/14/2020, 1:51 PMvineethraj49
08/14/2020, 1:51 PMwasyl
08/14/2020, 1:53 PMby lazy { runBlocking { …. Just throwing ideasstreetsofboston
08/14/2020, 2:08 PMval lz = Obj() as the first statement in the GlobalScope.launch?
GlobalScope.launch {
val lz = with(<http://Dispatchers.IO|Dispatchers.IO>) { Obj() } // use IO, since creation of Obj() is blocking
val concurrency = 128
...
}vineethraj49
08/14/2020, 2:15 PM