[uClibc] pthread problem
Syam Krishna Babbellapati
syamkris at gmail.com
Mon Jun 13 17:34:25 UTC 2005
I am currently facing a problem regarding pthreads while running on
MIPS 4Kc processor.
Environment details: uClibc version is 0.9.26, gcc-3.3.4, linux-2.4.20
kernel, processor :MIPS 4Kc with MMU.
When I run the code which is attached below, the following sequence of
1. Main forks - creating a child process
2. Child process - issues a pthread_create
After this, I should ideally see parent, child and the new thread
getting time slices in a round robin fashion.
But, what we see on the target is that parent and the new thread run
forever alternately and child process gets blocked (or in other words
it doesn't run at all). If we let the thread to exit, then the child
process gets a chance and runs.
One other interesting thing is - if we do a static compilation
(instead of using shared library) with pthread library, then the
Also, the same code when run with a gcc on the x86 host works just
fine irrespective of how it is compiled with no such scheduling
The toolchain, which I am using is an in-house toolchain built using
I am curious, if any one of you can give me any pointers. Do you think
it is a problem with some build options in uClibc?
Please let me know your views on if you have encountered
Here is the code which is bothering me.
void *thread_func(ram *r1)
int i = 1000, iRetVal;
printf("Thread test program\n");
printf("\n Now calling fork\n");
printf("Now calling Pthread\n");
if((iRetVal = pthread_create(&threadid, NULL, ((void*)thread_func),&r2)) != 0)
printf("Creating STUN thread failed\n");
printf("In the child process*********************\n");
printf("In the child\n");
printf("In the parent process*********************\n");
printf("In the parent \n");
More information about the uClibc