Part Number:CC3235S
请问:调用pthread_attr_init(&pAttrs) 后,
线程优先级(sched_priority)和 堆栈stacksize缺省值分别是多少?
priority)数字越高,线程优先级是越高还是越低?
Kevin Qiu1:
优先级和stack size在main函数中后面的代码都有涉及
pthread_t thread;pthread_attr_t pAttrs;struct sched_param priParam;int retc;int detachState;/* Call board init functions */Board_init();/* Set priority and stack size attributes */pthread_attr_init(&pAttrs);priParam.sched_priority = 1;detachState = PTHREAD_CREATE_DETACHED;retc = pthread_attr_setdetachstate(&pAttrs, detachState);if(retc != 0){/* pthread_attr_setdetachstate() failed */while(1){;}}pthread_attr_setschedparam(&pAttrs, &priParam);retc |= pthread_attr_setstacksize(&pAttrs, THREADSTACKSIZE);if(retc != 0){/* pthread_attr_setstacksize() failed */while(1){;}}retc = pthread_create(&thread, &pAttrs, mainThread, NULL);if(retc != 0){/* pthread_create() failed */while(1){;}}BIOS_start();return (0);priority数字越大,优先级越高
,
Kelvin Lee:
有些线程没有调用 retc |= pthread_attr_setstacksize(&pAttrs, THREADSTACKSIZE);
那么缺省的stacksiz又应该是多少呢?!
,
Kevin Qiu1:
你在哪个例程发现没有tread stack size或者task stack size的?
TI-rtos中默认的task stack size是1024