@@ -741,22 +741,22 @@ the standard `lazy` function in cases when computation of the value involves sus
741741
742742We can define async-style functions that invoke ` doSomethingUsefulOne ` and ` doSomethingUsefulTwo `
743743_ asynchronously_ using [ async] coroutine builder. It is a good style to name such functions with
744- either "async" prefix of " Async" suffix to highlight the fact that they only start asynchronous
745- computation and one needs to use the resulting deferred value to get the result.
744+ " Async" suffix to highlight the fact that they only start asynchronous computation and one needs
745+ to use the resulting deferred value to get the result.
746746
747747``` kotlin
748- // The result type of asyncSomethingUsefulOne is Deferred<Int>
749- fun asyncSomethingUsefulOne () = async {
748+ // The result type of somethingUsefulOneAsync is Deferred<Int>
749+ fun somethingUsefulOneAsync () = async {
750750 doSomethingUsefulOne()
751751}
752752
753- // The result type of asyncSomethingUsefulTwo is Deferred<Int>
754- fun asyncSomethingUsefulTwo () = async {
753+ // The result type of somethingUsefulTwoAsync is Deferred<Int>
754+ fun somethingUsefulTwoAsync () = async {
755755 doSomethingUsefulTwo()
756756}
757757```
758758
759- Note, that these ` asyncXXX ` function are ** not** _ suspending_ functions. They can be used from anywhere.
759+ Note, that these ` xxxAsync ` functions are ** not** _ suspending_ functions. They can be used from anywhere.
760760However, their use always implies asynchronous (here meaning _ concurrent_ ) execution of their action
761761with the invoking code.
762762
@@ -767,8 +767,8 @@ The following example shows their use outside of coroutine:
767767fun main (args : Array <String >) {
768768 val time = measureTimeMillis {
769769 // we can initiate async actions outside of a coroutine
770- val one = asyncSomethingUsefulOne ()
771- val two = asyncSomethingUsefulTwo ()
770+ val one = somethingUsefulOneAsync ()
771+ val two = somethingUsefulTwoAsync ()
772772 // but waiting for a result must involve either suspending or blocking.
773773 // here we use `runBlocking { ... }` to block the main thread while waiting for the result
774774 runBlocking {
0 commit comments