OC 线程操作1 - pthread
#import "ViewController.h"
#import <pthread.h> //1.需要包含这个头文件
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//2.创建线程对象
pthread_t p;
//3.创建线程
/*
参数1 : pthread_t _Nullable *restrict _Nonnull, 线程对象,传递地址
参数2 : const pthread_attr_t *restrict _Nullable, 线程属性 , NULL
参数3 : void * _Nullable (* _Nonnull)(void * _Nullable), 指向函数的指针
参数4 : void *restrict _Nullable, 函数需要的参数
*/
pthread_create(&p, NULL, task, NULL);
}
void *task(void *pama){
return NULL;
}
@end
OC 线程操作1 - pthread的更多相关文章
- OC 线程操作2 - NSThread
方法1 :直接创建 alloc init - (void)createNSThread111{ /* 参数1: (nonnull id) 目标对象 self 参数2:(nonnull SEL) ...
- OC 线程操作 - GCD队列组
1.队列组两种使用方法2.队列组等待 wait /** 新方法 队列组一般用在在异步操作,在主线程写队列组毫无任何作用 */ - (void)GCD_Group_new_group___notify{ ...
- OC 线程操作 - GCD快速迭代
- (void)forDemo{ //全都是在主线程操作的 ; i<; i++) { NSLog(@"--%@", [NSThread currentThread]); } ...
- OC 线程操作3 - NSOperation
#import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...
- OC 线程操作 - GCD使用 -同步函数,异步函数,串行队列,并发队列
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ // GCD 开几条线程并不是我们 ...
- OC 线程操作 - GCD使用 -线程通讯, 延迟函数和一次性代码
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ // [self downImag ...
- OC 线程操作3 - NSOperation 实现线程间通信
#import "ViewController.h" @interface ViewController () /** 图片 */ @property (weak, nonatom ...
- OC 线程操作 - GCD使用 - 栅栏函数
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ //同步函数无需栅栏函数 //栅栏 ...
- OC线程操作-GCD介绍
1. GCD介绍 1.11.2 1.3 异步具备开启能力但是不是 一定可以开启 1.4 1.5 67. 8.
随机推荐
- WebStorm新创建项目介绍
WebStorm创建一个项目 这里支持有很多的类型项目: Empty Project ----一个空的项目 Html5 Boilerplate ----HTML5开发框架 We ...
- c/c++基础 const
int main(int argc, char* argv[]) { '; '; a1='; //a2='2'; //a2是字符常量 "; "; a3="; //a4=& ...
- [重点]delphi 实现 根据给定的标题去《中国青年报》网上电子报数据中查找匹配的内容,并从该内容中取出引题、正题、副题、作者和正文。
项目要求:根据给定的标题去<中国青年报>网上电子报数据中查找匹配的内容,并从该内容中取出引题.正题.作者和正文. unit Unit1; interface uses Winapi.Win ...
- nginx优化——包括https、keepalive等
一.nginx之tcp_nopush.tcp_nodelay.sendfile 1.TCP_NODELAY你怎么可以强制 socket 在它的缓冲区里发送数据?一个解决方案是 TCP 堆栈的 TCP_ ...
- Java中Pattern类的quote方法将任何字符串(包括正则表达式)都转换成字符串常量,不具有任何匹配功能
Java中Pattern类的quote方法将任何字符串(包括正则表达式)都转换成字符串常量,不具有任何匹配功能. 下面是个例子: import org.junit.Test; import java. ...
- Winform 事件
事件参数:object sender - 事件主体EventArgs e - 事件数据函数体 - 我进行的操作 常用事件:点击事件click (1)Load事件:该事件在窗体加载到内存时发生,即在第一 ...
- Linux部署项目
1 安装jdk 第一步:获取Linux系统中jdk安装包和tomcat安装包(后面要用,所以上传两个) 第二步:使用secureCRT客户端工具连到服务器 第三步:使用命令创建一个目录,作为软件的安装 ...
- vue 异步请求
摘自 ECMAScript 6 简介: 大家习惯将 ECMAScript 6.0 简称为 ES6,它是 Javascript 语言的下一代标准,它的目标,是使得 Javascript 语言可以用来编写 ...
- linux键盘驱动
http://blog.csdn.net/beyondhaven/article/details/5753182 http://blog.chinaunix.net/uid-20564848-id-7 ...
- elastastic search
curl -X PUT "10.97.184.40:9200/logstash-2015.05.18" -H 'Content-Type: application/json' -d ...