Hiya, This drove me *nuts* last night. Here's the condensed example: //gcc -static -Wall -o bugdemo bugdemo.c -lpthread #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h>
//void vodd(){fork();}
void f1(){printf("f1\n");} void f2(){printf("f2\n");} int main() { pthread_t th1,th2; system("echo sh"); if(pthread_create(&th1,NULL,(void*)f1,NULL))exit(1); if(pthread_create(&th2,NULL,(void*)f2,NULL))exit(2); if(pthread_join(th1,NULL))exit(3); if(pthread_join(th2,NULL))exit(4); return 0; } This crashes after printing "f1", but, uncomment the unused vodd() function and everything's happy. Compile with libpthread.so, rather than libpthread.a, again, all's well. Bug in the version of libpthread.a I've got? (I'm using Debian unstable, last updated about a month ago.) If someone could try it under different linucies (Ugh!!!) I'd be interested what happens. Thanks. Bill ------------------------------------------------------------------------- W.B.Hill \ Email: wbh@uea.ac.uk \ 492 Earlham Road \ Home: (+44) 1603 455069 \ "Nothing is idiot-proof Norwich NR4 7HP. \ Fax: 0870 054 7508 \ given the right idiot" United Kingdom \ Mobile: 0410 781584 \ (+44) 1603 255141 \ Web: http://wbh.org \ #include <stdisclaimer.h> ------------------------------------------------------------------------- PGP-Fingerprint: B3 6F 2E D6 - B6 48 F1 FB -*- 7C AA 28 0C - 96 61 9A B5
[ This email came to you via the Anglian Linux User Group list ] [ If you only wish to recieve event announcements, email the ] [ SUBJECTs of "unsubscribe alug" and "subscribe alug-announce" ] [ to listserver@stu.uea.ac.uk -- We do need your support, tho' ]