void waitForIdle() {
synchronized (LoaderTask.this) {
mHandler.postIdle(new Runnable() {
public void run() {
synchronized (LoaderTask.this) {
LoaderTask.this.notify();
}
}
});
try {
this.wait();
} catch (InterruptedException ex) {
}
}
}
synchronized (LoaderTask.this) {
mHandler.postIdle(new Runnable() {
public void run() {
synchronized (LoaderTask.this) {
LoaderTask.this.notify();
}
}
});
try {
this.wait();
} catch (InterruptedException ex) {
}
}
}
本文详细介绍了如何使用同步和消息队列机制实现并发任务的等待空闲处理,包括关键代码片段解析。
355

被折叠的 条评论
为什么被折叠?



