pthread_create

 

pthread_create
   UNIX 环境创建线程函数,具体格式:
   #include<pthread.h>
   int pthread_create(pthread_t *restrict tidp,const pthread_attr_t *restrict attr,void* *start_rtn)(void*),void *restrict arg);
  返回值:若成功则返回 0 ,否则返回出错编号
  返回成功时,由 tidp 指向的内存单元被设置为新创建线程的线程 ID attr 参数用于制定各种不同的线程属性。新创建的线程从 start_rtn 函数的地址开始运行,该函数只有一个无指针参数 arg ,如果需要向 start_rtn 函数传递的参数不止一个,那么需要把这些参数放到一个结构中,然后把这个结构的地址作为 arg 的参数传入。

你可能感兴趣的:(unix)