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

WTEventAction -executeWithContext:线程问题 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

PerfectShen
Copy link

WTEventAction -executeWithContext: 线程问题修改

wangshen added 2 commits April 25, 2018 16:50
1.添加截图
1.WTEventAction  -executeWithContext: 线程间切换问题导致item被释放
Copy link
Owner

@hongruqi hongruqi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样改应该不行,问题的根源是,WTEventItem 是weak 的。多线程时,推出当前栈,会被释放。

@PerfectShen
Copy link
Author

可以的 如果当前是主线程,那就直接执行,如果是子线程分两种情况,第一种执行队列是非主队列,那么同步执行,还在当前线程中。如果是主队列,会分发到主队列执行,但是item不会被释放。几种情况都测试过了

Kapusta616 referenced this pull request Aug 29, 2020
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

Successfully merging this pull request may close these issues.

2 participants