powerpc uClibc0.9.32 threads ( old and NPTL)
Andrei
ayakimov at iptec-inc.com
Wed Dec 28 23:04:12 UTC 2011
It looks broken for me.
You can build a uClibc 0.9.32 - no problem there.
it working fine with uClibc 0.9.30.3.
I have build uClibc 0.9.32 using buildroot2011.08 and
crosstool-ng-1.13.2 an crosstool-ng-1.13.0
This test faling for me at two thread model (old and NPTL) in 0.9.32,
but working with uClibc 0.9.30.3. (old only - NPLT not supported for
powepc):
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
pthread_t thread;
int param = 1;
void *test(void *hndl) {
printf("Thread started with param: %d\n", *((int *)hndl));
while(1) ;
}
int start_tread()
{
pthread_attr_t attr;
struct sched_param sched;
int res;
sched.sched_priority= 10;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
res = pthread_attr_setstacksize (&attr, 16*1024);
if(res != 0) {
printf("cannnot set a stack: %s.\n", strerror(res));
return 0;
}
res = pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
if(res != 0) {
printf("cannnot set policy: %s.\n", strerror(res));
return 0;
}
res = pthread_attr_setschedparam(&attr, &sched);
if(res != 0) {
printf("cannnot set sheduler: %s.\n", strerror(res));
return 0;
}
if(getuid() == 0){
res =
pthread_attr_setinheritsched(&attr,PTHREAD_EXPLICIT_SCHED);
if(res != 0) {
printf("cannnot set inherit: %s.\n", strerror(res));
return 0;
}
}
res = pthread_create(&thread, &attr, test, ¶m);
if(res != 0) {
printf("cannnot start therad: %s.\n", strerror(res));
return 0;
}
return 1;
}
int main ()
{
start_tread();
while(1);
}
Any advise?
Thanks, Andrei
More information about the uClibc
mailing list