zoukankan      html  css  js  c++  java
  • android kotlin 协程使用经验

    1.    https://www.kotlincn.net/docs/reference/coroutines/cancellation-and-timeouts.html

      runBlocking 也是非常有用的,,,用在很多需要 立即运行,,不能挂起的场合

    2.  
      阻塞线程

    表达式内部

    是否有返回值

    并发执行
    runBlocking 
    true true false(串行)
    withContext false true false
    launch
    false false false
    asyc false true true

    3.安卓的StrictMode模式似乎不识别 launch(Dispatchers.IO) 的线程切换
    StrictMode: StrictMode policy violation: android.os.strictmode.NetworkViolation
    需要使用 launch(newSingleThreadContext("xxxxThread"))
  • 相关阅读:
    java-oop集合map
    IDEA启动Tomcat报错
    1.IDEM的快捷键
    1.idea快捷键
    14.
    13.级联一对多
    12.动态SQL
    11.动态参数
    10.主键回填
    9.参数的传递
  • 原文地址:https://www.cnblogs.com/caosq/p/14011298.html
Copyright © 2011-2022 走看看