Android Dev/Compose

Coroutines 잊기 쉬운 개념 정리

YoonHyeonJoon 2022. 2. 4. 00:54

1. async { } 과 launch { } 차이

 

1>async는 return값이 존재한다. launch는 return 이 없다

2>async는 Deffered이며, launch 는 Job이다.

3>Deffered는 await() method를 지원함

 

 

2. job이 끝나는 시점은 join() 호출 이후가 된다.

 

3. 만약 다수의 job이 동시에 끝난 이후 어떤 작업을 하고자한다면 listOf(x,y,~~~).joinAll() 을 호출하면됨