lukaville
04/25/2019, 6:22 PMTransferMode.UNSAFE
when we properly synchronise everything using posix mutexes and we don’t have references to the objects in the passing worker?lukaville
04/25/2019, 6:24 PMval worker = Worker.start()
worker.execute(
mode = TransferMode.UNSAFE,
producer = { Unit },
job = {
val a = mutableListOf<Int>()
val worker2 = Worker.start()
worker2.execute(
mode = TransferMode.UNSAFE,
producer = { a },
job = { list ->
sleep(1)
GC.collect()
sleep(1)
list.add(1)
print(list)
}
)
}
)
is it guaranteed that list a
will not be GCed after worker1 finished?kpgalligan
04/25/2019, 6:27 PMkpgalligan
04/25/2019, 6:28 PMkpgalligan
04/25/2019, 6:29 PMkpgalligan
04/25/2019, 6:29 PMkpgalligan
04/25/2019, 6:30 PMlukaville
04/25/2019, 6:32 PMa
will be collected by GC when the outer worker is finished?kpgalligan
04/25/2019, 6:33 PMkpgalligan
04/25/2019, 6:34 PMkpgalligan
04/25/2019, 6:34 PMkpgalligan
04/25/2019, 6:34 PMArkadii Ivanov
04/25/2019, 6:36 PMkpgalligan
04/25/2019, 6:37 PMkpgalligan
04/25/2019, 6:38 PMArkadii Ivanov
04/25/2019, 6:54 PMkpgalligan
04/25/2019, 6:56 PM