#include
by berniechen - Linux环境编程 - 2008-09-12 13:00:04 阅读(14512) 回复(4)
#include <pthread.h>
#include
如何man到pthread_create的const pthread_attr_t *restrict attr文档。 man pthread_create看不到attr的说明,想了解下attr有几种情况。请问如何man。
我想通过pthread_attr_getstack来得到线程的默认属性值 但是得到的结果比较奇怪 有高手帮忙可以分析一下吗? 怎么stackaddr是0,stacksize也是0? 难道是pthread_create的时候临时申请的吗? 我写了一个pthread_create 测试了一下还是这个结果哦 [code] pthread_attr_t attr; void *stackaddr; size_t stacksize; pthread_attr_init(&attr); pthread_attr_getstack(&attr,&stackaddr,&stacksize); printf("statck address = %p st...
有2问题: 1.pthread_attr_getstack()在设置堆栈大小之前获取不到堆栈大小值。而pthread_attr_getstacksize却可以. 2.APUE2上有这么一句话: Also, if we change the stackaddr thread attribute, the system assumes that we will be managing our own stacks and disables stack guard buffers, just as if we had set the guardsize thread attribute to 0. 我自己的理解是:修改了堆栈地址时,会在内部(可能是系统调用内部?)...
pthread_attr_t attr; int pocily; int ret; pthread_attr_init(&attr); if (ret =pthread_attr_setschedpolicy(&attr, SCHED_FIFO)) { printf("set ched policy failed -- %s \n", strerror(ret)); return -1; } if (pthread_attr_getschedpolicy(&attr, &pocily)) { printf("set ched policy failed -- %s \n", strer...
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/35079/showart_269852.html