在主线程连接了 socket,在异步的准备工作做好了解除主线程阻塞。
主线程阻塞:
mConnectThread = new ConnectionManagerImpl.ConnectionThread(" Connect thread for " + info);
mConnectThread.setDaemon(true);
mConnectThread.start();
synchronized (mConnectThread) {
try {
mConnectThread.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
子线程初始化成功后解除主线程阻塞:
在子 Thread 的 run()中
synchronized (this) {
this.notifyAll();
}
结果 android 主线程直接无限阻塞了。。。。求大佬支招
主线程阻塞:
mConnectThread = new ConnectionManagerImpl.ConnectionThread(" Connect thread for " + info);
mConnectThread.setDaemon(true);
mConnectThread.start();
synchronized (mConnectThread) {
try {
mConnectThread.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
子线程初始化成功后解除主线程阻塞:
在子 Thread 的 run()中
synchronized (this) {
this.notifyAll();
}
结果 android 主线程直接无限阻塞了。。。。求大佬支招