google-developer-training / android-basics-kotlin-mars-photos-app

Apache License 2.0
92 stars 193 forks source link

Android Basics: Coroutines #116

Closed chrii closed 2 years ago

chrii commented 2 years ago

name: Android Basics Unit 4 issue about: Report problems with the Android Basics Unit 4 codelabs title: 'Android Basics Unit 4 issue:' labels: '' assignees: ''


https://developer.android.com/codelabs/basic-android-kotlin-training-introduction-coroutines?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-kotlin-unit-4-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-training-introduction-coroutines#5

Step 6 - The solution code

I am wondering if this is right or the Kotlin Playground does not provide a proper output. At the playground I got this:

Thread[DefaultDispatcher-worker-1 @coroutine#1,5,main] has started 
Thread[DefaultDispatcher-worker-1 @coroutine#1,5,main] - Starting 
Thread[DefaultDispatcher-worker-2 @coroutine#2,5,main] has started 
Thread[DefaultDispatcher-worker-2 @coroutine#2,5,main] - Starting 
Thread[DefaultDispatcher-worker-2 @coroutine#3,5,main] has started 
Thread[DefaultDispatcher-worker-2 @coroutine#3,5,main] - Starting

But the Thead code shows this output:

Thread[Thread-2,5,main] has started 
Thread[Thread-2,5,main] - Starting 
Thread[Thread-0,5,main] - Starting 
Thread[Thread-1,5,main] - Starting 
Thread[Thread-2,5,main] - Doing Task 1 
Thread[Thread-0,5,main] - Doing Task 1 
Thread[Thread-1,5,main] - Doing Task 1 
Thread[Thread-2,5,main] - Doing Task 2 
Thread[Thread-0,5,main] - Doing Task 2 
Thread[Thread-1,5,main] - Doing Task 2 
Thread[Thread-2,5,main] - Ending 
Thread[Thread-0,5,main] - Ending 
Thread[Thread-1,5,main] - Ending

Steps to reproduce? Just go to the Kotlin playground and copy&paste the solution code https://developer.android.com/training/kotlinplayground

osuleymanova commented 2 years ago

@chrii Thank you for reaching out to us and sharing your concern. But no worries, there is no error, the outputs should be different as on the screenshot below: Screen Shot 2022-04-15 at 3 54 56 PM