在创建线程前可以设置该线程的属性,可设置的属性有:(线程默认的属性是: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. 其它属性