zoukankan      html  css  js  c++  java
  • iOS pthread

     

        pthread 是属于 POSIX 多线程开发框架

       创建线程的方法:pthread_create

       

        参数含义:

         1.指向线程代号的指针

         2.线程的属性

         3.指向函数的指针

         4.传递给该函数的参数

         

         返回值

         - 如果是0,标示正确

         - 如果非0,标示错误代码

         

         void *   (*)      (void *)

         返回值   (函数指针)  (参数)

         void *  和OC中的  id 是等价的!

     

       int result = pthread_create(&threadId, NULL, &demo, (__bridge  void *)(str));

       

        if (result == 0) {

            NSLog(@"OK");

        }else{

            NSLog(@"error %d",result);

        }

     

     

     

     

    响应方法:

    void * demo(void * param){

        NSLog(@"%@ %@",[NSThread currentThread],param);

        

        return NULL;

    }

     

     

     

  • 相关阅读:
    linux 重定向命令
    G++依赖安装顺序
    SQL*Plus Error Messages
    理解 chroot
    CRM的基本功能有哪些?
    GCC依赖安装顺序
    RHEL6.3 安装GCC 记录
    python requests模块http请求
    安装paramiko模块
    python执行系统命令的方法:os.system(), os.popen(), subprocess.Popen()
  • 原文地址:https://www.cnblogs.com/jukaiit/p/10021277.html
Copyright © 2011-2022 走看看