igor.wojda
04/29/2020, 7:24 PMsortedList like this? https://twitter.com/igorwojda/status/1255416485293502465araqnid
04/29/2020, 7:27 PMoctylFractal
04/29/2020, 7:29 PMDispatchers.Main (if you have it) or Executors.newSingleThreadExecutor().asDispatcher(), you could actually make this thread safeEvan R.
04/29/2020, 7:29 PMoctylFractal
04/29/2020, 7:29 PMDominaezzz
04/29/2020, 7:30 PMoctylFractal
04/29/2020, 7:30 PMcoroutineScope {
for (elm in list) {
launch(properDispatcher) {
delay(1000L * elm)
sortedList.add(elm)
}
}
}Evan R.
04/29/2020, 7:30 PMcoroutineScope() builder and either a mutex or a channel to control access to the shared list lolEvan R.
04/29/2020, 7:31 PMDominaezzz
04/29/2020, 7:31 PMlaunch .octylFractal
04/29/2020, 7:31 PMDominaezzz
04/29/2020, 7:32 PMoctylFractal
04/29/2020, 7:33 PMcoroutineScope or the loop with withContext in that caseEvan R.
04/29/2020, 7:35 PMEvan R.
04/29/2020, 7:36 PMDominaezzz
04/29/2020, 7:36 PMchannelFlow { ... }.toList() . 😁Evan R.
04/29/2020, 7:37 PMKroppeb
04/29/2020, 8:47 PM