Network start --- multithreading --- blocking main thread (demonstration) (1), --- Multithreading

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.