This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2025-02-13 11:33:30.198 9900-9972 System.out A | |
| 2025-02-13 11:33:30.199 9900-9972 System.out C | |
| 2025-02-13 11:33:31.203 9900-9973 System.out B | |
| 2025-02-13 11:33:31.207 9900-9973 System.out D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : ComponentActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| CoroutinesTrickyQuestionsTheme { | |
| Surface( | |
| modifier = Modifier.fillMaxSize(), | |
| color = MaterialTheme.colorScheme.background | |
| ) { | |
| Box(modifier = Modifier.wrapContentSize()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2024-05-13 11:33:30.198 9900-9972 System.out A | |
| 2024-05-13 11:33:30.199 9900-9972 System.out С | |
| 2024-05-13 11:33:31.203 9900-9973 System.out B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val myScope: CoroutineScope = CoroutineScope(context = Job()) | |
| myScope.launch { | |
| delay(500L) | |
| println("A") | |
| launch { | |
| delay(1000L) | |
| println("B") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val myScope: CoroutineScope = CoroutineScope(context = Job()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2024-05-13 10:43:21.233 32562-32614 System.out A | |
| 2024-05-13 10:43:21.336 32562-32613 System.out C | |
| 2024-05-13 10:43:22.237 32562-32613 System.out B | |
| 2024-05-13 10:43:22.238 32562-32613 System.out D |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val myScope: CoroutineScope = CoroutineScope(context = Job()) | |
| myScope.launch { | |
| delay(500L) | |
| println("A") | |
| coroutineScope { | |
| launch { | |
| delay(1000L) | |
| println("B") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : ComponentActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContent { | |
| CoroutinestrickyquestionsTheme { | |
| Surface( | |
| modifier = Modifier.fillMaxSize(), | |
| color = MaterialTheme.colorScheme.background | |
| ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MainActivity : AppCompatActivity() { | |
| private lateinit var binding: ActivityMainBinding | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| binding = ActivityMainBinding.inflate(layoutInflater) | |
| setContentView(binding.root) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal suspend fun downloadUserData(): String { | |
| withContext(Dispatchers.IO) { | |
| println("downloadUserData started on ${Thread.currentThread().name}") | |
| val result1 = async { receiveAdditionalUserData(taskNumber = 1) } | |
| val result2 = async { receiveAdditionalUserData(taskNumber = 2) } | |
| println(result1.await()) | |
| println(result2.await()) |
NewerOlder