Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

消息队列管理为什么size==1才执行 ,如果>1 那么岂不是无法执行了? #1256

Open
kahzix opened this issue Sep 29, 2020 · 2 comments

Comments

@kahzix
Copy link

kahzix commented Sep 29, 2020

private void enqueueAction(Action action) {
mQueue.add(action);
if (mQueue.size() == 1) {
handleAction();
}else{
Log.i(TAG,"mQueue.size != 1 : "+mQueue.size());
}
}

In addition, we do not accept issues unrelated to Fragmentation.

@javabean8
Copy link

在多线程的情况下,可能会出现,单线程不会

@JantHsueh
Copy link

因为一旦进入handleAction 就会一直从队列获取数据,直到为空,
不会出现多线程的问题,因为所有Action 都是发送到主线程中,进行入队的。
可参考我维护的版本 #1237 ,解决了一些问题,对难理解的地方进行了注释

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants