Re: Weird bug in linux, glibc, gcc or what?

From: Catalin Marinas (c_marinas@yahoo.com)
Date: Fri Feb 08 2002 - 04:48:38 EST


On Thu, 7 Feb 2002, Felipe Contreras wrote:

> I've found a weird problem in linuxthreads. When I get out of a thread it
> happends one of three, the new thread get's defuct and the proccess never
> ends, it segfaults, or it works.
[snip]
> #include <pthread.h>
>
> void *test(void *arg) {
> puts("Thread2");
> return 0;
> }
>
> int main() {
> pthread_t tt;
> puts("Before Thread2");
> pthread_create(&tt,NULL,test,NULL);
> puts("After Thread2");
> return 0;
> }

Try this patch and see if it works:

--- thr_test.c Fri Feb 8 09:45:35 2002
+++ thr_test1.c Fri Feb 8 09:45:36 2002
@@ -10,5 +10,6 @@ int main() {
         puts("Before Thread2");
         pthread_create(&tt,NULL,test,NULL);
         puts("After Thread2");
+ pthread_join(tt, NULL);
         return 0;
 }

-- 
Catalin

________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs SkyScan service. For more information on a proactive anti-virus service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Feb 15 2002 - 21:00:16 EST