多线性的实现

线性的创建

pthread_create函数

函数的作用:创建线程

表头文件:#include <pthread.h>

函数原型:int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, void *(*start_rtn)(void), void *restrict arg)

函数参数:*restrict tidp要创建的线程ID指针

                   *restrict attr创建线程时的线程属性

                   void*(start_rtn)(void):返回值是void类型的指针函数

                  void *restrict arg:start——rtn的形参

返回值:成功返回0,其他值表示错误

pthread_exit

函数的作用:终止线程

表头文件:#include <pthread.h>

函数的原型:void pthread_exit(void *retval)

返回值:调用线程的返回值

pthread_join

函数作用:等待线程

表头文件:#include<pthread.h>

函数原型:int pthread_join(thread_t tid, void **status)

函数参数:tid:要等待的线程ID,status线程状态

返回值:成功返回0.其他白哦是错误

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_26654257

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值