Network start --- multithreading --- blocking main thread (demonstration) (1), --- Multithreading
1 # import "ILViewController. h "2 3 @ interface ILViewController () 4 5 @ end 6 7 @ implementation ILViewController 8 9-(void) viewDidLoad10 {11 [super viewDidLoad]; 12 13 // The current thread, to determine which thread this method is in, you can print this thread. When num = 1, it is in the main thread 14 // other threads in the Child thread, time-consuming operations cannot be placed in the main thread, so time-consuming operations cannot be placed in the viewDidLoad method to be executed in a non-main thread, 15 [NSThread currentThread] In the background thread or child thread; 16 17 // Do any additional setup after loading the view, typically from a nib.18} 19 20-(void) touchesBegan :( NSSet *) touches withEvent :( UIEvent *) event21 {22 for (int I = 0; I <10000; I ++) {23 NSLog (@ "--------- % d", I); 24} 25} 26 27 @ end