This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Problem on pthread_join()
- From: "Kathy Lo" <kathy dot lo dot ky at gmail dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 22 Mar 2006 15:16:44 +0800
- Subject: Problem on pthread_join()
Dear,
I encounter the problem of using pthread_join().
I am using RedHat 9.0 with GLIBC 2.3.2-11.9 and NPTL 0.29.
I am writing a program to create joinable threads using
pthread_create(). Then, my main program waits for created threads to
terminate by calling pthread_join(). Actually, my program will create
2 threads (Thread 1 and Thread 2), wait for Thread 1 to terminated
first, then, wait for Thread 2 to terminated.
When I run this program once, it works correctly.
When I run this program several times at a time, there are several
proceses running this program concurrently. After all the concurrent
processes finish, I repeated to run these processes concurrently
again. But, sometimes, one of these several processes still running.
Then, I found that this process waits for pthread_join() to return but
Thread 2 had already exited. It seems that pthread_join() cannot
detect the terminiation of Thread 2.
What is the problem in threading library? Please help me to solve this problem.
--
Kathy Lo