[snip] > > > > logmsg("Putting into queue %p slot %d", reqq, reqq_write_idx); > > > > reqq[reqq_write_idx++] = req; > > reqq_write_idx %= reqq_size; > > logmsg("Inserted req == %p; nto == %d; to == %p", > > reqq[reqq_read_idx], reqq[reqq_read_idx]->nto, > > reqq[reqq_read_idx]->to); > > > Not sure if that is the problem, but you are incrementing the index and thus > the second logmsg()-call is logging the content of a free slot in your queue. > : ) Heh, yeah, you're right :) - but I checked the situation in gdb, it confirmed the problem (and a segfault didn't deny it either ;-)) > > Is my understanding that the > > malloc'ed memory area can be shared between threads in a process correct? > Yes, threads share a common address-space (at least here they do and in every > system I have come across), the consumer-producer design is typical in > threaded apps and relies on that. So was my understanding, but I had a moment of doubt :-) regards, marek
Attachment:
pgpducB31SmV5.pgp
Description: PGP signature