11/30 I'm having a problem running a toy pthreads program on FreeBSD. I ran
strace on it and it looks like it exits after SIGUSR1 or SIGUSR2. The
same program seems to run fine on (dare I say it) Linux. Any ideas?
[why can't you not put source files in the motd?]
\_ most people won't read it if its in a file.
\_ Insert after the creates:
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
I have no idea what I'm doing. -clueless-sodan
\_ Yep, you definitely to somehow block so that the threads
have time to execute. Otherwise main() will just
exit; whether or not it waits for threads to run to
termination is implementation dependent.
\_ Yeah, I just figured out that this is true. I guess
this is one other aspect where Linux tries to act
smart for you. The annoying thing is that I copied
the example right out of the pthreads book from Sun.
The Sun Press authors generally don't leave this sort
of thing out. (Yes the book is on pthreads, not solaris
threads).
\_ Build with gcc -pthread?
\_ I compiled with cc -g -Wall -pthread -o thread_test thread_test.c
the two print_msg functions never get called.
\_ Please follow the clueless-sodan's advice. -clueless-sodan |