记一次主线程等待子线程结束的多种方法的学习 在学习多线程时,最开始遇到的问题其实是"计算子线程运行时间",写到最后发现本文和标题更为符合,但是仍然基于问题:"在主线程中获取子线程的运行时间". while循环 对于"主线程如何获取子线程总运行时间"的问题,最开始想到的是使用while循环进行轮询: Thread t = new Thread(() -> { //子线程进行字符串连接操作 int num = 1000; String s =
This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release. 是因为在子线程中刷新了UI 解决方法是将刷新ui的操作放到主线程