zoukankan      html  css  js  c++  java
  • 网络开始---多线程---阻塞主线程(演示)(一)

     1 #import "ILViewController.h"
     2 
     3 @interface ILViewController ()
     4 
     5 @end
     6 
     7 @implementation ILViewController
     8 
     9 - (void)viewDidLoad
    10 {
    11     [super viewDidLoad];
    12     
    13     //当前线程 ,判断这个方法在哪个线程中,可以打印这个线程,当num==1时,是在主线程中
    14     //其他的在子线程中 ,不能把耗时的操作放在主线程中,所以不能把耗时的操作放在viewDidLoad方法里执行 耗时操作要放到非主线程中,后台线       程或者子线程中
    15     [NSThread currentThread];
    16     
    17     // Do any additional setup after loading the view, typically from a nib.
    18 }
    19 
    20 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    21 {
    22     for (int i = 0; i<10000; i++) {
    23         NSLog(@"---------%d", i);
    24     }
    25 }
    26 
    27 @end
  • 相关阅读:
    racket eval
    mex不兼容
    【转】雷军 程序员随想
    UBoot 目录结构和编译过程
    远程监控web开发
    STL容器[08]
    STL容器[07]
    STL容器[17]
    STL容器[06]
    stl.map使用总结
  • 原文地址:https://www.cnblogs.com/ithongjie/p/4818070.html
Copyright © 2011-2022 走看看