並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 3 件 / 3件

新着順 人気順

Coroutineの検索結果1 - 3 件 / 3件

  • サーバーサイド Java / Kotlin エコシステムに潜む ThreadLocal ~ Kotlin Coroutine と ThreadLocal を安全につなぎこむ - 株式会社ヘンリー エンジニアブログ

    こんにちは!ヘンリーでソフトウェアエンジニアをしている @agatan です。 今日は小ネタで、サーバーサイド Java / Kotlin エコシステムで意外と使われている ThreadLocal と、それを Coroutine と安全に組み合わせる方法について紹介します! TL; DR ThreadContextElementを使おう! ThreadLocal とは java.lang.ThreadLocal<T> は、その名の通り、スレッドローカルな(= スレッドごとに独立した値を持つ)変数を定義するための機構です。 ある Thread で値を書き換えたとしても、他の Thread から見た ThreadLocal 変数の中身は書き換わらない、という性質があります。 import kotlin.concurrent.thread val tls: ThreadLocal<Int> =

      サーバーサイド Java / Kotlin エコシステムに潜む ThreadLocal ~ Kotlin Coroutine と ThreadLocal を安全につなぎこむ - 株式会社ヘンリー エンジニアブログ
    • Advanced Kotlin Coroutine Cheat sheet (for Android Engineer)

      So, you’ve been working with Kotlin Coroutines for a while and you’re already familiar with basic concepts like suspend functions and thelaunchbuilder. But as your projects become more complex, you might find yourself frequently searching for advanced solutions and asking Google or your favorite AI for help. This cheat sheet consolidates the key insights I’ve picked up along the way. It’s designed

        Advanced Kotlin Coroutine Cheat sheet (for Android Engineer)
      • Maybe Everything Is a Coroutine - Adam Nelson

        I was inspired, after reading the excellent blog post Let Futures Be Futures, by the author's thought experiment of a language in which all functions are coroutines and this is used to express asynchronicity: async functions can yield a type called Pending when awaiting some async action, while pure, synchronous functions can yield Never, indicating that they never yield at all. The more I thought

        1