2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Coroutineって多分こういう事。

Last updated at Posted at 2019-11-24
  1. 指定したthreadの処理(図ではMain thread)にCoroutineの処理がわりこむ。Main threadでcoroutineの処理が始まる。
  2. Coroutine内のsuspend function(データ取ってきたり、5秒delayさすとか、終わるまでcoroutineの処理を一時停止させる処理)が終わるのをまっている間、Main threadはcoroutine外の処理に戻って実行できる。
  3. suspend functionが終われば、またcoroutineの処理の続きに戻る。
    UNADJUSTEDNONRAW_thumb_d85.jpg

緑の色鉛筆がMain threadの想定される処理順序です。
##ref.
codelab 6章
非同期処理の概念について解説
Kotlin の Coroutine を概観する

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?