官术网_书友最值得收藏!

Flexible

Kotlin offers many different primitives that allow for simple-yet-flexible concurrency. You will find that there are many ways to do concurrent programming in Kotlin. Here is a list of some of the topics we will look at throughout the book:

  • Channels: Pipes that can be used to safely send and receive data between coroutines.
  • Worker pools: A pool of coroutines that can be used to divide the processing of a set of operations in many threads.
  • Actors: A wrapper around a state that uses channels and coroutines as a mechanism to offer the safe modification of a state from many different threads.
  • Mutual exclusions (Mutexes): A synchronization mechanism that allows the definition of a critical zone so that only one thread can execute at a time. Any coroutine trying to access the critical zone will be suspended until the previous coroutine leaves.
  • Thread confinement: The ability to limit the execution of a coroutine so that it always happens in a specified thread.
  • Generators (Iterators and sequences): Data sources that can produce information on demand and be suspended when no new information is required.

All of these are tools that are at your fingertips when writing concurrent code in Kotlin, and their scope and use will help you to make the right choices when implementing concurrent code.

主站蜘蛛池模板: 亚东县| 长垣县| 浦东新区| 枣强县| 孟津县| 闽清县| 石楼县| 渝中区| 揭东县| 泌阳县| 寿宁县| 和硕县| 凌云县| 慈溪市| 贡嘎县| 焦作市| 独山县| 靖安县| 祥云县| 龙井市| 甘洛县| 灵武市| 白山市| 佛冈县| 隆化县| 哈巴河县| 团风县| 嘉黎县| 金秀| 石林| 满洲里市| 虞城县| 确山县| 洞口县| 泸州市| 城固县| 巴楚县| 全州县| 蒙阴县| 霍邱县| 尚志市|