pawel_byszewski
01/16/2017, 1:19 PMadambl4
01/16/2017, 1:27 PMpawel_byszewski
01/16/2017, 1:39 PMpawel_byszewski
01/16/2017, 1:57 PMawait
operation and new thread for continue
part. Let’s consider some code
println(“one”)
async {
await(longOperation()) // longOperation prints “two”
println(“three")
}
every string is printed on another thread. For me it is unintuitive. I have faced up the problem to print “three” on the same thread as “one” thats why I am looking for some async-await implementationorangy
elizarov
01/16/2017, 3:37 PMawait(…)
is a suspending function defined in Kovenant library. When you invoke a suspending function your computation gets suspended and the thread it was running on is free to do any other stuff. The implementation of a particular suspending function decides on how and when your computation is resumed. This particular library (Kovenant) is multi-threaded (it has multiple threads to resume your code). If you are looking for Node.JS style execution where everything works in the same thread, you’ll have to write (or find) a library that schedules everything into the single thread. Kotlin standard library provides all the necessary building blocks, so that writing such single-threaded coroutine library is straighforward.elizarov
01/16/2017, 3:39 PMilya.gorbunov
01/16/2017, 3:43 PMilya.gorbunov
01/16/2017, 3:43 PMpawel_byszewski
01/16/2017, 3:54 PMpawel_byszewski
01/16/2017, 3:54 PMaaverin
01/17/2017, 10:41 AMilya.gorbunov
01/17/2017, 10:42 AMaaverin
01/17/2017, 10:46 AMpawegio
01/17/2017, 11:15 AMudalov
damian
01/17/2017, 7:04 PMThis feature is only available since Kotlin 1.1
even though the project is configured for 1.1-M04? actually, every error shows up three times 😕damian
01/17/2017, 7:12 PM.idea
... nothing seems to get rid of itcedric
01/17/2017, 7:15 PMdamian
01/17/2017, 7:17 PMilya.gorbunov
01/17/2017, 7:19 PMPasted image at 2017-01-17, 22:19▾
damian
01/17/2017, 7:20 PMilya.gorbunov
01/17/2017, 7:23 PMOk, could you add Kotlin settings facet then?▾
user
01/17/2017, 7:24 PMhttps://kotlinlang.slack.com/files/U0AAQKT9Q/F3TC82W94/pasted_image_at_2017_01_17_22_23.png▾
pawegio
01/17/2017, 7:29 PMdamian
01/17/2017, 7:29 PMilya.gorbunov
01/17/2017, 7:30 PMdamian
01/17/2017, 7:33 PMScreenshot 2017-01-17 14.31.55▾
+
button is only for creating new modules)damian
01/17/2017, 7:33 PM.idea
though, which should have a similar effectdamian
01/17/2017, 7:37 PMScreenshot 2017-01-17 14.36.45.png▾