[coroutine] Cancellation and Timeouts ( 취소와 타임아웃 ) [coroutine] Cancellation and Timeouts ( 취소와 타임아웃 ) https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/cancellation-and-timeouts.md#cancellation-and-timeouts Cancelling coroutine execution -오랜 시간 운영되는 앱의 경우 bg coroutine 을 잘 컨트롤 할 필요가 있다.예를 들어 user 가 coroutine 을 수행시킨 page 를 닫고, 해당 작업의 결과는 더 이상 필요없다면, 해당 작업을 취소시킬 필요가 있다."launch" 함수는 Job 을 return 하며, 이 녀석은 동작중인 coroutine 을 취소시킬 수 있다.fun m.. 2020. 3. 9. [coroutine] exception 을 이해해보자 #1 ( in my coroutine scope ) -이 글은 coroutine exception 에 대한 일종의 심화과정이라고 볼 수 있다.기본 exception 에 대한 내용을 먼저 이해한 후 이곳의 글을 보자![coroutine] Exception handling -class MainActivity : Activity() { private val coroutineScope = CoroutineScope(Dispatchers.Main) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) findViewById(R.id.btn).setOnClickListener { try { co.. 2019. 3. 5. 반응형 이전 1 다음