We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
override func main() {
while self.isCancelled == false { self.isMainThreadBlock = true DispatchQueue.main.async { self.isMainThreadBlock = false self.semaphore.signal() } Thread.sleep(forTimeInterval: self.threshold) if self.isMainThreadBlock { self.handler?() } self.semaphore.wait(timeout: DispatchTime.distantFuture) }
按照我自己的代码思维: 当前变量isMainThreadBlock = YES, 让当前线程休眠0.4秒,看主线程是否修改了当前的变量isMainThreadBlock 值是否函数回调。但是我看不明白这个信号量在这个中所要做的事情是什么?
The text was updated successfully, but these errors were encountered:
用来控制ping主线程的,你debug下就明白了。或者看《iOS监控编程》中卡顿监控篇
Sorry, something went wrong.
No branches or pull requests
override func main() {
按照我自己的代码思维: 当前变量isMainThreadBlock = YES, 让当前线程休眠0.4秒,看主线程是否修改了当前的变量isMainThreadBlock 值是否函数回调。但是我看不明白这个信号量在这个中所要做的事情是什么?
The text was updated successfully, but these errors were encountered: