Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect when the main thread is locked/busy (IOS)

Tags:

ios

nsthread

Is there any way to detect when the main thread is locked/busy (aka will not respond to touch events) ?

possible directions check the size of the dispatch_get_main_queue (but i dont know how to manipulate this object to see its size)

[[UIApplication sharedApplication] isIgnoringInteractionEvents] but this method only works part of the time

like image 678
user353877 Avatar asked Sep 05 '25 23:09

user353877


1 Answers

Use instruments tool "time profiler" and then find the clue about what's blocking your main thread.

For example: I find a method is running 12.7% cpu time of main thread. Then I find it has name "waitingThread". It looks like the method is blocking the main thread.

enter image description here

like image 87
hrchen Avatar answered Sep 08 '25 22:09

hrchen