powerpc uClibc0.9.32 threads ( old and NPTL)

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Thu Dec 29 18:54:53 UTC 2011


On Dec 29, 2011 12:10 AM, "Andrei" <ayakimov at iptec-inc.com> wrote:
>
> 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, &param);
>    if(res != 0) {
>        printf("cannnot start therad: %s.\n", strerror(res));
>        return 0;
>    }
>    return 1;
> }
>
> int main ()
> {
>        start_tread();
>
>        while(1);
> }
>
>
> Any advise?

How does it fail?
Can you reproduce it with current master?


More information about the uClibc mailing list