线程属性

在创建线程前可以设置该线程的属性,可设置的属性有:(线程默认的属性是:detachstate is PTHREAD_JOINABLE, scheduling policy is SCHED_OTHER,  nouser-provided stack)

1.        线程的分离状态(detachstat), 如果设置为分离状态,则不能接受pthread_join.

2.        线程栈的位置,不使用默认提供的栈,而是自己申请内存并指定该内存作为栈使用。pthread_attr_getstackaddr / pthread_attr_setstackaddr

3.        线程栈的大小,pthread_attr_getstacksize / pthread_attr_setstacksize

4.        控制线程优先级,pthread_getschedparam / pthread_setschedparam / pthread_setschedprio

5.        线程cancel的状态和类型。状态可以是Enable or Disable。取消类型可以是延迟取消或异步取消。延迟取消必须在可取消点才可以取消。

A similarfunction, named pthread_setcanceltype() is used to define how a thread respondsto a cancellation request, assuming it is in the 'ENABLED' cancel state. Oneoption is to handle the request immediately (asynchronously). The other is todefer the request until a cancellation point.

6.        并发度,pthread_getconcurrency / pthread_setconcurrency

7.        警戒线,(针对栈溢出)

8.        其它属性


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值