pthread

作者: fanzq_jianshu | 来源:发表于2016-05-15 19:40 被阅读56次

~ 写在正文之前:文章转移到翻这个墙中,希望继续关注啦。(2017.11.5)

  • 说明:pthread的基本使用(需要包含头文件)
#import <pthread.h>
    //使用pthread创建线程对象
    pthread_t thread;
    NSString *name = @"wendingding";
    //使用pthread创建线程
    //第一个参数:线程对象地址
    //第二个参数:线程属性.NULL
    //第三个参数:指向函数的指针
    //第四个参数:传递给该函数的参数.NULL
    pthread_create(&thread, NULL, run, (__bridge void *)(name));

    //加入到某个线程中
    //    pthread_join(<#pthread_t#>, <#void **#>)
//    pthread_yield_np();//放弃线程

相关文章

网友评论

      本文标题:pthread

      本文链接:https://www.haomeiwen.com/subject/pugvrttx.html