Linux多线程基本函数

按照所学的进度会不断更新...虽然学的可能有点慢

1、pthread_create():创建线程

头文件:#include<pthread.h>

函数声明:

int pthread_create(pthread_t *restrict tidp, //新创建的线程ID指向的内存单元
           const pthread_attr_t *restrict_attr, //设置线程属性,默认为NULL
           void*(*start_rtn)(void*), //新创建的线程从start_rtn函数的地址开始运行
           void *restrict arg);//默认为NULL,若上述函数需要参数,将参数放入结构中并将地址作为arg传入

返回值:若创建成功返回0,否则返回出错编号

猜你喜欢

转载自www.cnblogs.com/z1014601153/p/11329823.html
今日推荐