deviant
03/20/2017, 9:17 AMlaunch(context + job1 + job2){}
is it possible to use 2 different parents to control child lifecycle? well, i know it's not. but what best way to achieve such functionality?kingsley
03/20/2017, 8:25 PMprivate val callbackContext = ...
fun request(...) {
pendingJob?.cancel()
pendingJob = launch(callbackContext) {
delay(DEBOUNCE_PERIOD)
...
suspendingFun()
...
}
}
suspend fun suspendingFun(...) {
someApi().await()
...
}
This used to work fine in version 0.12. Currently on version 0.14, the launch block doesn't seem to execute more than once anymore. Not sure what the problem isoshai
03/22/2017, 6:28 AMdstarcev
03/23/2017, 1:05 PMTask.WhenAll()
in kotlin?sreich
03/24/2017, 4:41 PMorangy
03/24/2017, 8:29 PMnquinn
03/25/2017, 9:10 PMuli
03/31/2017, 7:42 AMuli
03/31/2017, 7:48 AMsuspend fun delay(time: Long, unit: TimeUnit = TimeUnit.MILLISECONDS) {
require(time >= 0) { "Delay time $time cannot be negative" }
if (time <= 0) return // don't delay
Wouldn't it be more comfortable to not have require(time >= 0)
Especially, as the implementation for time < 0 follwos right on the next linemenegatti
03/31/2017, 10:53 AMuli
04/02/2017, 7:42 PMfun main(args: Array<String>) {
val f = future {
throw RuntimeException("Hello!")
}
f.await()
}
uli
04/02/2017, 9:05 PMuli
04/04/2017, 6:53 AMfun inBackground(doWork: suspend () -> Unit) {
launch(CommonPool) {
try {
doWork()
} catch (t: Throwable) {
// Do Logging, rethrow, ...
}
}
}
fun main(args: Array<String>) {
inBackground {
println("before delay")
delay(100)
println("after delay")
}
Thread.sleep(100000)
}
Ideally, inBackground() should be inline. But that is not yet supported.voghdev
04/05/2017, 10:24 AMnfrankel
04/06/2017, 7:35 AMvar results = listOf<SearchResult>()
runBlocking<Unit> {
results = providers.map {
async(CommonPool) {
it.search()
}
}.map { it.await() }
}
return results
Ian
04/06/2017, 2:31 PMthread {}
appears to do?Ian
04/06/2017, 2:58 PMsreich
04/07/2017, 4:44 PMcontext
field? seems like a map but i don't get what the key issreich
04/07/2017, 5:33 PMnewFixedThreadPoolContext
to create a fixed amount of threads to run my function on..but i think i need to know the thread id it's running on (0 or 1..n)groostav
04/08/2017, 8:57 PMreadMessage
method, I write a suspending function on top of the event-callback for https://msdn.microsoft.com/en-us/library/windows/desktop/aa365788(v=vs.85).aspxyasyd
04/09/2017, 10:24 AMrafal
04/10/2017, 8:07 AMnimtiazm
04/10/2017, 9:26 AMvonox7
04/11/2017, 6:16 PMkingsley
04/11/2017, 8:20 PMrunBlocking
seems to give up immediately it encounters an interrupt, leaving the suspending function in a possibly corrupt mode. Or maybe I'm only overthinking this? 🤔wineluis
04/13/2017, 9:52 AMdmitry.petrov
04/13/2017, 1:42 PMelizarov
04/13/2017, 5:26 PMjkbbwr
04/13/2017, 5:30 PMnimtiazm
04/13/2017, 5:50 PMurl "<https://dl.bintray.com/kotlin/kotlin-eap-1.1>"
nimtiazm
04/13/2017, 5:50 PMurl "<https://dl.bintray.com/kotlin/kotlin-eap-1.1>"
ilya.gorbunov
04/13/2017, 6:15 PMjcenter
is enough