以前都用whilt循环等待异步任务然后跳出循环 其实有更好的方法val downloadDeferred = CompletableDeferred<Boolean>()
val downloadDeferred2 = CompletableDeferred<Boolean>()//异步任务
new Thread(){
downloadDeferred.complete(执行结果) // 下载成功时设置结果
}.start
new Thread(){
downloadDeferred2.complete(执行结果) // 下载成功时设置结果
}.start
val downloadRet = downloadDeferred.await()
val downloadRet2 = downloadDeferred2.await()