Pthread (line libraries, very early technology, understand):
A common set of multithreaded APIs
Suitable for systems such as Unix\linux\windows (Java development also has pthread)
Cross-platform \ Portable
Very difficult to use (all C functions)
C language
Programmers manage the thread life cycle, almost without
Nsthread (Master):
Use more object-oriented
Easy to use, direct manipulation of thread objects
OC language
Programmers manage the thread life cycle (Sugau regardless of death), occasionally using
GCD (powerful, focused):
Designed to replace threading technology such as Nsthread
Make the most of your device's multicore (features)
C language
Automatically manage the thread life cycle, often using
Nsoperation (Key):
Based on gcd (bottom is GCD)
More simple and practical features than GCD.
Use more object-oriented
OC language
Automatically manage the thread life cycle, often using
////VIEWCONTROLLER.M//02-Understanding-pthread Simple Use////Created by Xiaomage on 16/2/18.//2016 little brother. All rights reserved.//#import "ViewController.h"#import<pthread.h>@interfaceViewcontroller ()@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; }-(Ibaction) Btnclick: (ID) Sender {//NSLog (@ "%@", [Nsthread CurrentThread]); //1. Create thread object, including header file #import <pthread.h>pthread_t thread; //2. Create a thread function /*first parameter: Thread object pass address second argument: Thread's property NULL third argument: pointer to function Fourth argument: function needs to accept arguments*/Pthread_create (&thread, NULL, task, NULL); // //1. Create a Thread objectpthread_t threadb;// // //2. Create a thread function// /*//first parameter: Thread object delivery address//second parameter: Thread's properties NULL//third parameter: pointer to a function//Fourth parameter: parameters to be accepted by the function// */Pthread_create (&threadb, NULL, task, NULL); Pthread_equal (thread, threadb);}void* Task (void*param) { for(Nsinteger i =0; i<2; i++) {NSLog (@"%zd----%@", I,[nsthread CurrentThread]); } NSLog (@"%@--------", [Nsthread CurrentThread]); returnNULL;}@end
Ios30---pthread, nsthread, GCD, nsoperation