[lkml]   [2002]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Weird bug in linux, glibc, gcc or what?

On 20020207 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.
>The most weird is that it depends on the kernel, and also when I run the
>test trought gdb there is no problem.
>Here is the test:
>#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;

Buggy program that could give unspecified behaviour, unless pthread
standard talks about orphaned threads...

Your main program can die (exit) before child thread ends, so it has
nobody to notify its dying or return to.

Try with a sleep(1) before main return, or better, do a

J.A. Magallon # Let the source be with you...
Mandrake Linux release 8.2 (Cooker) for i586
Linux werewolf 2.4.18-pre9-slb #3 SMP Fri Feb 8 01:33:12 CET 2002 i686
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:24    [W:0.030 / U:34.060 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site