Greetings and Salutations to all! 

I became interested in writing code that takes advantage of pthreads and
of course decided to write a little "it really works" program. I went
ahead and wrote a little program that builds a small queue with two
threads, one which writes the queue and one that reads the queue. 

The program works rather well and I was proud of myself... at least until
I changed:

struct que {
   struct item *head;
   struct item *tail;
 };

into:

struct que {
   struct item *head;
   struct item *tail;
        int counter;
 };


When I make this one tiny change, the program stops working by
supposedly segfaulting on the pthread_create call. However I was able to
realize by copious debugging printfs that the thread I am creating is
indeed running.

What have I done wrong? I can't find anything wrong, nor can about half a
dozen of my friends that have worked with pthreads before.

As a side note, I'm compiling with :
gcc -g -Wall threadexamp.c -o threadexamp -lpthread
-- 
GnuPG fingerprint AAE4 8C76 58DA 5902 761D  247A 8A55 DA73 0635 7400
James Blackwell  --  Director http://www.linuxguru.net

Attachment: threadexamp.c.bz2
Description: Binary data

Reply via email to