From c83269b9d2bdee823c737a61d0ba69301d702450 Mon Sep 17 00:00:00 2001 From: Omooo <869759698@qq.com> Date: Fri, 17 Jan 2020 21:57:37 +0800 Subject: [PATCH] Update HandlerThread.md --- blogs/Android/HandlerThread.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blogs/Android/HandlerThread.md b/blogs/Android/HandlerThread.md index c224645..1dc910c 100644 --- a/blogs/Android/HandlerThread.md +++ b/blogs/Android/HandlerThread.md @@ -103,6 +103,7 @@ public class HandlerThread extends Thread { Looper.prepare(); synchronized (this) { mLooper = Looper.myLooper(); + // 通知取 Looper 的线程,此时 Looper 已经创建好了 notifyAll(); } Process.setThreadPriority(mPriority); @@ -119,6 +120,7 @@ public class HandlerThread extends Thread { synchronized (this) { while (isAlive() && mLooper == null) { try { + // 如果新线程还未创建 Looper,则等待 wait(); } catch (InterruptedException e) { }