#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的更多相关文章

  1. OC 线程操作2 - NSThread

        方法1 :直接创建 alloc init - (void)createNSThread111{ /* 参数1: (nonnull id) 目标对象 self 参数2:(nonnull SEL) ...

  2. OC 线程操作 - GCD队列组

    1.队列组两种使用方法2.队列组等待 wait /** 新方法 队列组一般用在在异步操作,在主线程写队列组毫无任何作用 */ - (void)GCD_Group_new_group___notify{ ...

  3. OC 线程操作 - GCD快速迭代

    - (void)forDemo{ //全都是在主线程操作的 ; i<; i++) { NSLog(@"--%@", [NSThread currentThread]); } ...

  4. OC 线程操作3 - NSOperation

    #import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...

  5. OC 线程操作 - GCD使用 -同步函数,异步函数,串行队列,并发队列

    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ // GCD 开几条线程并不是我们 ...

  6. OC 线程操作 - GCD使用 -线程通讯, 延迟函数和一次性代码

    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ // [self downImag ...

  7. OC 线程操作3 - NSOperation 实现线程间通信

    #import "ViewController.h" @interface ViewController () /** 图片 */ @property (weak, nonatom ...

  8. OC 线程操作 - GCD使用 - 栅栏函数

    - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ //同步函数无需栅栏函数 //栅栏 ...

  9. OC线程操作-GCD介绍

    1. GCD介绍 1.11.2 1.3 异步具备开启能力但是不是 一定可以开启 1.4 1.5 67. 8.

随机推荐

  1. 各种Queue分析

    Queue主要方法的区别:   抛出异常 返回特殊值 插入 add(e)插入成功则返回true,没有可用空间则IllegalStateException offer(e) 移除 remove(e)获取 ...

  2. 命令行下将磁盘从GPT转换为MBR

    1.在系统提示无法安装的那一步,按住“shift+f10”,呼出“cmd”命令符 2.输入:diskpart,回车 进入diskpart 3.输入:list disk,回车 显示磁盘信息 4.输入:s ...

  3. Kotlin语言学习笔记(3)

    数据类(Data Classes) data class User(val name: String, val age: Int) 编译器自动生成的有: equals()/hashCode() toS ...

  4. ubuntu去除带锁文件的锁 sudo chown 用户名 目标文件夹/ -R

    sudo chown 用户名 目标文件夹/ -R sudo chown han dir/ -R

  5. Java解决输出数组问题

    package test; public class doubleshuzu { public static void main(String[] args) { double a[][]; Stri ...

  6. ESET官方下载地址

    官方远程下载 ESET NOD32 Antivirus(32位) ESET NOD32 Antivirus(64位) ESET Smart Security(32位) ESET Smart Secur ...

  7. Oracle 未能加载文件或程序集Oracle.DataAccess

    原文地址;https://www.cnblogs.com/xuekai-to-sharp/p/3586071.html 关键是引用DLL:Oracle.DataAccess.dll DLL文件的路径: ...

  8. 学习JS的心路历程-参数传递方式(上)

    很多人认为JS的传递方式是值是Call by value, 物件及数组是Call by Reference.甚至还有人宣称其实JS是Call by sharing,那到底是哪一个呢? 这两天我们一一来 ...

  9. u-boot 内核 启动参数

    kernel如何得到uboot启动信息: http://blog.sina.com.cn/s/blog_89d9bec60101bzen.html u-boot向linux内核传递启动参数: http ...

  10. 安装PostGIS 2.1.1 时遇到checking for library containing GDALAllRegister... no

    在postgis中执行./configure时,遇到 checking for library containing GDALAllRegister... no 的错误信息 [root@test po ...