Home Subscribe

TimeoutをKotlin Coroutinesで

01 Feb 2021

公式にちゃんとTimeoutの例がある。すごく書きやすい感じ。

withTimeout(1300L) {
    repeat(1000) { i ->
        println("I'm sleeping $i ...")
        delay(500L)
    }
}

参考

  • Cancellation and Timeouts
Wataru Suzuki's Picture

Wataru Suzuki

A Mobile App Developer. a.k.a. JchanKchan.

Share this post

Twitter Facebook Google+
JchanKchan © • All rights reserved.
Made with Jekyll using Kasper theme